Beispiel #1
0
static void
htdoc_run_page(fz_context *ctx, fz_page *page_, fz_device *dev, const fz_matrix *ctm, fz_cookie *cookie)
{
	html_page *page = (html_page*)page_;
	html_document *doc = page->doc;
	fz_matrix local_ctm = *ctm;
	int n = page->number;

	fz_pre_translate(&local_ctm, doc->page_margin[L], doc->page_margin[T]);

	fz_draw_html(ctx, doc->box, n * doc->page_h, (n+1) * doc->page_h, dev, &local_ctm);
}
Beispiel #2
0
static void
epub_run_page(fz_context *ctx, fz_page *page_, fz_device *dev, const fz_matrix *ctm, fz_cookie *cookie)
{
	epub_page *page = (epub_page*)page_;
	epub_document *doc = page->doc;
	epub_chapter *ch;
	int n = page->number;
	int count = 0;

	for (ch = doc->spine; ch; ch = ch->next)
	{
		int cn = ceilf(ch->html->root->h / ch->html->page_h);
		if (n < count + cn)
		{
			fz_draw_html(ctx, dev, ctm, ch->html, n-count);
			break;
		}
		count += cn;
	}
}
Beispiel #3
0
static void
epub_run_page(fz_context *ctx, fz_page *page_, fz_device *dev, const fz_matrix *ctm, fz_cookie *cookie)
{
	epub_page *page = (epub_page*)page_;
	epub_document *doc = page->doc;
	epub_chapter *ch;
	fz_matrix local_ctm = *ctm;
	int n = page->number;
	int count = 0;

	for (ch = doc->spine; ch; ch = ch->next)
	{
		int cn = ceilf(ch->box->h / ch->page_h);
		if (n < count + cn)
		{
			fz_pre_translate(&local_ctm, ch->page_margin[L], ch->page_margin[T]);
			fz_draw_html(ctx, ch->box, (n-count) * ch->page_h, (n-count+1) * ch->page_h, dev, &local_ctm);
			break;
		}
		count += cn;
	}
}