Question about TIFF and PDF
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan
-
- User
- Posts: 48
- Joined: Mon May 21, 2007 5:39 pm
Question about TIFF and PDF
I'm testing PDFXChange and creating PDFs,
but I'd like to convertmy completed PDFs to TIFF
(using a dll or com object - no printers, virtual or otherwise)
Can I use Image XChange to do this?
I'm using VB6, but I only see a demo for viewing. The ImagesTest.exe sample looks most promising but it's in C. Is there a VB version?
Thanks.
but I'd like to convertmy completed PDFs to TIFF
(using a dll or com object - no printers, virtual or otherwise)
Can I use Image XChange to do this?
I'm using VB6, but I only see a demo for viewing. The ImagesTest.exe sample looks most promising but it's in C. Is there a VB version?
Thanks.
-
- Site Admin
- Posts: 5219
- Joined: Tue Jun 29, 2004 10:34 am
- Location: United Kingdom
Hi,
No - you will need to use the Viewer SDK to achive this - this is included in the PDF-Tools SDK for limited distribution.
Currently you have only the choice of using the Simple Viewer DLL SDK - but coming very shortly is the ActiveX of the full End user Viewer SDK - which may suit you better.
HTH
No - you will need to use the Viewer SDK to achive this - this is included in the PDF-Tools SDK for limited distribution.
Currently you have only the choice of using the Simple Viewer DLL SDK - but coming very shortly is the ActiveX of the full End user Viewer SDK - which may suit you better.
HTH
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.
Best regards
Tracker Support
http://www.tracker-software.com
Best regards
Tracker Support
http://www.tracker-software.com
-
- User
- Posts: 48
- Joined: Mon May 21, 2007 5:39 pm
-
- Site Admin
- Posts: 5219
- Joined: Tue Jun 29, 2004 10:34 am
- Location: United Kingdom
Hi Wayne,
Whilst this is entirely possible - we dont offer an example at this time as our main focus is on completion of the Viewer SDK ActiveX, The End User version and also Version 4 of all our products - so we are at this time at full stretch.
Essentially - the Simple Viewer SDK can render to a DIB section or HBITMAP. after this you can use Windows GDI+ to save to any format supported by Windows and there are copious notes on MSDN regarding GDI+ and its functionality.
Sorry we cannot help more at this time and we will look to add some sort of example in the 'nearish' future - but for now we just dont have the free time to add any extra demo app's.
Whilst this is entirely possible - we dont offer an example at this time as our main focus is on completion of the Viewer SDK ActiveX, The End User version and also Version 4 of all our products - so we are at this time at full stretch.
Essentially - the Simple Viewer SDK can render to a DIB section or HBITMAP. after this you can use Windows GDI+ to save to any format supported by Windows and there are copious notes on MSDN regarding GDI+ and its functionality.
Sorry we cannot help more at this time and we will look to add some sort of example in the 'nearish' future - but for now we just dont have the free time to add any extra demo app's.
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.
Best regards
Tracker Support
http://www.tracker-software.com
Best regards
Tracker Support
http://www.tracker-software.com
-
- User
- Posts: 48
- Joined: Mon May 21, 2007 5:39 pm
Perhaps you can take a quick look at what I have tried so far...
Code: Select all
Here's what I've done so far:
Public Declare Function PXCV_Init Lib "pxcview.dll" (ByRef doc As Long, ByVal Key As String, ByVal devcode As String) As Long
Public Declare Function PXCV_ReadDocumentW Lib "pxcview.dll" (ByVal doc As Long, ByVal Filename As String, ByVal Flags As Long) As Long
Public Declare Function PXCV_DrawPageToDC Lib "pxcview.dll" (ByVal doc As Long, ByVal page_num As Long, ByVal hDC As Long, renderparams As PXV_CommonRenderParameters) As Long
Public Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Public Declare Function DeleteDC Lib "gdi32" (ByVal hDC As Long) As Long
Public Type PXV_CommonRenderParameters
wholepagerect As RECT
drawrect As RECT
Flags As Long
rendertarget As Long
End Type
Public Const pxvrpf_Rotate_NoRotate As Long = &H0
Public Const pxvrpf_Rotate_Rotate90CW As Long = &H1
Public Const pxvrpf_Rotate_Rotate180 As Long = &H2
Public Const pxvrpf_Rotate_Rotate90CCW As Long = &H3
Public Const pxvrpf_UseVectorRenderer As Long = &H4
Public Const pxvrpf_RenderAsGray As Long = &H8
Public Const pxvrm_Viewing As Long = &H0
Public Const pxvrm_Printing As Long = &H1
Public Const pxvrm_Exporting As Long = &H2
Dim resolution As Long
Dim xTwip As Long
Dim pageW As Single
Dim pageH As Single
Dim rparams As PXV_CommonRenderParameters
resolution = 300
xTwip = 72
pageW = 11
pageH = 8.5
With bi.bmiHeader
.biBitCount = bitsout
.biPlanes = 1
.biCompression = BI_RGB
.biSize = Len(bi.bmiHeader)
.biWidth = pageW * resolution
.biHeight = pageH * resolution
.biSizeImage = (.biWidth * .biBitCount) + &H1F
.biSizeImage = .biSizeImage And Not &H1F&
.biSizeImage = .biSizeImage \ &H8
.biSizeImage = .biSizeImage * .biHeight
End With
compDC = CreateCompatibleDC(0)
mybitmap = CreateDIBSection(compDC, bi, DIB_RGB_COLORS, 0, 0, 0)
hOldObj = SelectObject(compDC, mybitmap)
blank.Bottom = pageH * resolution
blank.Top = 0
blank.Left = 0
blank.Right = pageW * resolution
' rparams.drawrect = vbNull ' entire page
rparams.Flags = pxvrpf_Rotate_NoRotate Or pxvrpf_UseVectorRenderer
rparams.rendertarget = pxvrm_Exporting
rparams.wholepagerect = blank
status = PXCV_Init(pdf, "<YOUR REG KEY>", "<YOUR DEV CODE>")
If (IS_DS_FAILED(status)) Then
GoTo badfunc:
End If
status = PXCV_ReadDocumentW(pdf, StrConv("C:\junk.pdf", vbUnicode), 0&)
If (IS_DS_FAILED(status)) Then
GoTo badfunc:
End If
status = PXCV_DrawPageToDC(pdf, 0&, compDC, rparams) ''FAILS HERE WITH ERROR -2112815103
If (IS_DS_FAILED(status)) Then
GoTo badfunc:
End If
-
- Site Admin
- Posts: 5219
- Joined: Tue Jun 29, 2004 10:34 am
- Location: United Kingdom
Hi Wayne,
I have passed this back to our DEV team and just as soon as I get an answer - I'll be back
Thanks for your patience.
I have passed this back to our DEV team and just as soon as I get an answer - I'll be back
Thanks for your patience.
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.
Best regards
Tracker Support
http://www.tracker-software.com
Best regards
Tracker Support
http://www.tracker-software.com
-
- Site Admin
- Posts: 5219
- Joined: Tue Jun 29, 2004 10:34 am
- Location: United Kingdom
Hi Wayne,
This is what I have back :
This is what I have back :
thanksThe code is incomplete -- I have no definitions for some functions (CreateDIBSection for example) and structures (RECT, BitmapInfoHeader)
Please send a complete sample and we can then check/correct as appropriate.
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.
Best regards
Tracker Support
http://www.tracker-software.com
Best regards
Tracker Support
http://www.tracker-software.com
-
- User
- Posts: 48
- Joined: Mon May 21, 2007 5:39 pm
-
- Site Admin
- Posts: 5219
- Joined: Tue Jun 29, 2004 10:34 am
- Location: United Kingdom
Hi Wayne,
Have located the problem in your code:
The issue is because in the PXV_CommonRenderParameters structure, the
fields wholepagerect and drawrect should not be a RECT structure but should be POINTERS to a RECT structure - this needs to be corrected and then all functions as it should.
Please see the attached updated source files.
HTH
Have located the problem in your code:
The issue is because in the PXV_CommonRenderParameters structure, the
fields wholepagerect and drawrect should not be a RECT structure but should be POINTERS to a RECT structure - this needs to be corrected and then all functions as it should.
Please see the attached updated source files.
HTH
You do not have the required permissions to view the files attached to this post.
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.
Best regards
Tracker Support
http://www.tracker-software.com
Best regards
Tracker Support
http://www.tracker-software.com
-
- User
- Posts: 48
- Joined: Mon May 21, 2007 5:39 pm
Thanks for the help so far.
I'm still running into a few issues when creating TIFF from PDFs.
1) If I use the DrawToDC method, the resulting image is rather low quality (lots of missing image) and the watermark from the PDF doesn't show up.
2a) If I instead use the DrawToDIB method, I get a better quality image, but still no watermark from the PDF.
2b) Also, the palette is "Min is Black" meaning palette 0 is black, not white as is normal. I have a method to resolve this but it doesn't work with DrawToDIB (it does work with DrawToDC)
(you can try this TIFF property viewer to see what I see: http://www.awaresystems.be/imaging/tiff ... iewer.html)
3) I tried using the Image XChange dll (i.e. PageCreateFromHBITMAP, etc) but have not been able to get it working. I was hoping to resolve issues 1 and 2 above by using this dll instead, but no luck.
I have uploaded another version of my sample code to illustrate the problems.
Again, thanks.
I'm still running into a few issues when creating TIFF from PDFs.
1) If I use the DrawToDC method, the resulting image is rather low quality (lots of missing image) and the watermark from the PDF doesn't show up.
2a) If I instead use the DrawToDIB method, I get a better quality image, but still no watermark from the PDF.
2b) Also, the palette is "Min is Black" meaning palette 0 is black, not white as is normal. I have a method to resolve this but it doesn't work with DrawToDIB (it does work with DrawToDC)
(you can try this TIFF property viewer to see what I see: http://www.awaresystems.be/imaging/tiff ... iewer.html)
3) I tried using the Image XChange dll (i.e. PageCreateFromHBITMAP, etc) but have not been able to get it working. I was hoping to resolve issues 1 and 2 above by using this dll instead, but no luck.
I have uploaded another version of my sample code to illustrate the problems.
Again, thanks.
You do not have the required permissions to view the files attached to this post.
-
- User
- Posts: 48
- Joined: Mon May 21, 2007 5:39 pm
-
- Site Admin
- Posts: 5219
- Joined: Tue Jun 29, 2004 10:34 am
- Location: United Kingdom
Hi wayne,
it is conceivable the watermarks issue may be ours - this wil need further investigateion when time allows - but I am afraid that will not be until V4 which as you know we are working on now.
with regards the other issues :
1. The PDF is landscape oriented, but you draw it as portrait. For sure it will be 'stretched'
2. TIFF corruption when DrawToDC is not our issue, but an issue with the library used to create the TIFF (the same with MinInBlack)
Also dont use the flag pxvrpf_UseVectorRenderer -- it can help improve quality -- GDI+ is good for high resolutions, but not for image sizes you are working with.
HTH
it is conceivable the watermarks issue may be ours - this wil need further investigateion when time allows - but I am afraid that will not be until V4 which as you know we are working on now.
with regards the other issues :
1. The PDF is landscape oriented, but you draw it as portrait. For sure it will be 'stretched'
2. TIFF corruption when DrawToDC is not our issue, but an issue with the library used to create the TIFF (the same with MinInBlack)
Also dont use the flag pxvrpf_UseVectorRenderer -- it can help improve quality -- GDI+ is good for high resolutions, but not for image sizes you are working with.
HTH
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.
Best regards
Tracker Support
http://www.tracker-software.com
Best regards
Tracker Support
http://www.tracker-software.com
-
- User
- Posts: 48
- Joined: Mon May 21, 2007 5:39 pm
Thanks for responding...
1) I'm not sure what you mean about portrait vs landscape. The original image, the pdf, and both sample tiffs are all landscape. It's not being stretched at all.
2) The corruption being caused by the FreeImage library is seems strange to me since I use it for both DrawToDC and ToDIBSection.
3) I will turn off the UseVectorRenderer flag.
Since you mention image size, can you tell me when a good time to use it? What resolutions/sizes?
4) Are you able to address the other issue - Why I can't seem to get the IMG_ library to work?(look for this in the uploaded sample: "CANNOT GET THIS TO WORK AT ALL" )
Thank You.
1) I'm not sure what you mean about portrait vs landscape. The original image, the pdf, and both sample tiffs are all landscape. It's not being stretched at all.
2) The corruption being caused by the FreeImage library is seems strange to me since I use it for both DrawToDC and ToDIBSection.
3) I will turn off the UseVectorRenderer flag.
Since you mention image size, can you tell me when a good time to use it? What resolutions/sizes?
4) Are you able to address the other issue - Why I can't seem to get the IMG_ library to work?(look for this in the uploaded sample: "CANNOT GET THIS TO WORK AT ALL" )
Thank You.
-
- Site Admin
- Posts: 5219
- Joined: Tue Jun 29, 2004 10:34 am
- Location: United Kingdom
Wayne,
if you really want us to get to grips with this and help - we need you to provide a basic application - that relies on no other 3rd party libraries/ActiveX's that you are unable to provide us directly.
Please provide :
A complete, basic project showing the problem without the any 3rd party ActiveX and works with the sample PDF/Images at 100%
Please provide the source and all reliant dll's and a compiled exe - Zipped -
Once we have this we will endeavour to assist and get this sorted as soon as possible
HTH
if you really want us to get to grips with this and help - we need you to provide a basic application - that relies on no other 3rd party libraries/ActiveX's that you are unable to provide us directly.
Please provide :
A complete, basic project showing the problem without the any 3rd party ActiveX and works with the sample PDF/Images at 100%
Please provide the source and all reliant dll's and a compiled exe - Zipped -
Once we have this we will endeavour to assist and get this sorted as soon as possible
HTH
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.
Best regards
Tracker Support
http://www.tracker-software.com
Best regards
Tracker Support
http://www.tracker-software.com
-
- User
- Posts: 48
- Joined: Mon May 21, 2007 5:39 pm
-
- Site Admin
- Posts: 5219
- Joined: Tue Jun 29, 2004 10:34 am
- Location: United Kingdom
Hi Wayne,
Pls see attached.
Pls see attached.
You do not have the required permissions to view the files attached to this post.
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.
Best regards
Tracker Support
http://www.tracker-software.com
Best regards
Tracker Support
http://www.tracker-software.com
-
- User
- Posts: 48
- Joined: Mon May 21, 2007 5:39 pm
Hi -
I'm trying the code you supplied, and I am able to get tiff output now (thank you!)
However, the quality of the image is still a concern.
I tried using the Save Dialog so that I could try a variety of settings,
but the image is still not as clean as I would like.
I've uploaded 2 samples - one using ImageXChange and another using a different product. I would prefer to use ImageXChange if I can get the output to look as good.
The settings are the same for both methods of conversion:
junk.pdf
300x300 resolution
CCITT 4
8.5x11
1 bit
No Dither
(DrawToDIBSection was used with ImageXChange)
Also, I noticed that the new Viewer has been released - is the ActiveX included?
Thanks....
I'm trying the code you supplied, and I am able to get tiff output now (thank you!)
However, the quality of the image is still a concern.
I tried using the Save Dialog so that I could try a variety of settings,
but the image is still not as clean as I would like.
I've uploaded 2 samples - one using ImageXChange and another using a different product. I would prefer to use ImageXChange if I can get the output to look as good.
The settings are the same for both methods of conversion:
junk.pdf
300x300 resolution
CCITT 4
8.5x11
1 bit
No Dither
(DrawToDIBSection was used with ImageXChange)
Also, I noticed that the new Viewer has been released - is the ActiveX included?
Thanks....
You do not have the required permissions to view the files attached to this post.
-
- User
- Posts: 48
- Joined: Mon May 21, 2007 5:39 pm