export an page as image

This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-Tools SDK of Library DLL functions(only) - Please use the PDF-XChange Drivers API SDK Forum for assistance with all PDF Print Driver related topics or PDF-XChange Viewer SDK if appropriate.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Sean - Tracker, Chris - Tracker Supp, Tracker Supp-Stefan

Post Reply
Dorwol
User
Posts: 278
Joined: Mon Aug 04, 2008 5:04 pm

export an page as image

Post by Dorwol » Fri Jul 03, 2015 6:05 pm

PXCp_SaveDocImageIntoFileW can only used, if a PDF has an images inside.

But HOW can I export an page as image (for example as "TIFF-file") from an existing PDF that don't include images?

Please can you tell me the needed function or give me a little code sample?

Ivan - Tracker Software
Site Admin
Posts: 3607
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: export an page as image

Post by Ivan - Tracker Software » Sat Jul 04, 2015 11:57 pm

The easiest way to export page of existing document is use the Simple Viewer SDK, and its function PXCV_DrawPageToIStream.
Here you can find description of that function and sample shown how to export page to PNG:

http://help.tracker-software.com/DEV/de ... etoistream
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.

Dorwol
User
Posts: 278
Joined: Mon Aug 04, 2008 5:04 pm

Re: export an page as image

Post by Dorwol » Sun Jul 05, 2015 1:38 pm

Ivan - Tracker Software wrote:The easiest way to export page of existing document is use the Simple Viewer SDK, and its function PXCV_DrawPageToIStream.
Here you can find description of that function and sample shown how to export page to PNG:
If I set TIFF and Bpp to 8 (gray) the saved TIFF is still in RGB. :?

Ivan - Tracker Software
Site Admin
Posts: 3607
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: export an page as image

Post by Ivan - Tracker Software » Sun Jul 05, 2015 7:46 pm

Please specify pxvrpf_RenderAsGray flag in Flags member of PXV_CommonRenderParameters structure you have passed to PXCV_DrawPageToIStream.
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.

Dorwol
User
Posts: 278
Joined: Mon Aug 04, 2008 5:04 pm

Re: export an page as image

Post by Dorwol » Mon Jul 06, 2015 11:38 am

Wow, seems to work! In particular, Bpp=1 with B/w generates wonderfull "CCITT4". :D

Dorwol
User
Posts: 278
Joined: Mon Aug 04, 2008 5:04 pm

Re: export an page as image

Post by Dorwol » Mon Jul 06, 2015 11:54 am

Last questions.

For exporting (not for printing) do you prefer this parameters?

- pxvrpf_UseVectorRenderer
- pxvrpf_EmbeddedFontsAsCurves AND/OR pxvrpf_AllFontsAsCurves

?

And how to set the DPI value? For example: I set m_DCX/Y to "150" but the exported TIFF has still 96 dpi. But I need 150 dpi.

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13428
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: export an page as image

Post by Tracker Supp-Stefan » Mon Jul 06, 2015 1:25 pm

Hello Dorwol,

I believe using vector rendering is faster but will need the devs to confirm that, so I believe it's better to use it.

As for the DPI - the TIFF file format stores that separately from the actual pixel count as far as I am aware - so you will need to specify it when generating the tiff (what tool are you using for that)? Otherwise - the pixel count will be the correct one you need for the 150 DPI and sie of the page, but reported as 96 dpi and "larger" physical dimensions.

Regards,
Stefan

Dorwol
User
Posts: 278
Joined: Mon Aug 04, 2008 5:04 pm

Re: export an page as image

Post by Dorwol » Mon Jul 06, 2015 4:56 pm

For example:

I have a TIFF file with dpi 300x300 and generate with Acrobat a new PDF. After a while I need to export this TIFF from my PDF. The result must still have a dpi-value "300", because if I generate from this TIFF a new PDF, the PDF page-size will be different from the first one.

So the only right way is to set the correct dpi-value.

Well, this is perfect possible with "PXCp_SaveDocImageIntoFileW" and the "pSaveOpts" (xDPI and yDPI values) parameter. But "PXCp_SaveDocImageIntoFileW" is not a part of the "Simple Viewer SDK" (you recommend me).

Meanwhile the export with "Simple Viewer SDK" works well, but not perfect. Becasue I need the possibility to set the DPI-Value like the "pSaveOpts" in "PXCp_SaveDocImageIntoFileW". But how exactly? Can you give me a sample code-part please?

Hope you do understand the reason better now! Or I'm wrong? :?

Ivan - Tracker Software
Site Admin
Posts: 3607
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: export an page as image

Post by Ivan - Tracker Software » Tue Jul 14, 2015 5:17 pm

For exporting (not for printing) do you prefer this parameters?

- pxvrpf_UseVectorRenderer
- pxvrpf_EmbeddedFontsAsCurves AND/OR pxvrpf_AllFontsAsCurves
For exporting you don't have to use any of these flags. They should be used only drawing on DC.
Becasue I need the possibility to set the DPI-Value like the "pSaveOpts" in "PXCp_SaveDocImageIntoFileW". But how exactly? Can you give me a sample code-part please?

Hope you do understand the reason better now! Or I'm wrong?
Yes, I do understand, but unfortunately in current build there are no way to specify DPI, and what is worth, current structure PXV_DrawToImageParams has no spare space to add such parameter.
Maximum what I can do is to use higher 16 bits of Bpp field of this structure to store DPI value.
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.

Dorwol
User
Posts: 278
Joined: Mon Aug 04, 2008 5:04 pm

Re: export an page as image

Post by Dorwol » Tue Jul 14, 2015 5:33 pm

For a better understanding: I need to export TIFs (for OCR and after OCR, I must create again PDF's). This is the reason, why the correct DPI value is so much important.

1. OK, so I spend time to insert "PXCp_SaveDocImageIntoFileW". But there was the problem, the export often fails, because if PDF's has no images.
2. So I spend time to insert "AX-Viewer SDK". But the Viewer will always create RGB images. Too big file size for "CCITT4".
3. And then, I spent time to implement "Simple Viewer SDK". Again much work to recode my application. And now the problem with dpi :evil: Arrrrgh! ...But I think, you have already understand my problem!? :mrgreen:

So I'm very thankful, if ylou have any solution for me to put the needed DPI value as parameter.
Ivan - Tracker Software wrote:
Maximum what I can do is to use higher 16 bits of Bpp field of this structure to store DPI value.
So I put the correct DPI-Value (not realy need "X" and "Y" - one DPI for X/Y is enough) in this field?

OK, that is a solution. But how long time you need?

Big THX!

Ivan - Tracker Software
Site Admin
Posts: 3607
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: export an page as image

Post by Ivan - Tracker Software » Tue Jul 14, 2015 7:25 pm

I did it already and can send you .dll file for testing. Do you use 32- or 64-bit DLL ?
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.

Dorwol
User
Posts: 278
Joined: Mon Aug 04, 2008 5:04 pm

Re: export an page as image

Post by Dorwol » Wed Jul 15, 2015 8:09 am

32 Bit only.

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13428
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: export an page as image

Post by Tracker Supp-Stefan » Mon Jul 20, 2015 11:39 am

Hello Dorwol,

I am making this post so that I can "close" the topic (we keep an eye on which topics are not answered by a member of our team).
Last Friday Ivan sent you the files. I hope they worked as intended!

Cheers,
Stefan

Post Reply