Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
![]() |
Not sure of how to work with loaded pdf file |
Post Reply
|
| Author | |
Carneno
Team Player
Joined: 19 Apr 11 Status: Offline Points: 24 |
Post Options
Thanks(0)
Quote Reply
Topic: Not sure of how to work with loaded pdf filePosted: 21 Apr 11 at 7:07PM |
|
Hello,
I'm developing a VB 6.0 printing program on an XP Pro, SP3 computer.
I want to load a PDF from a file, put some text on the page and print it using QuickPDF 7.24. After doing this:
QuickPDFResult = QuickPDFObject.LoadFromFile("C:\CoyneEDMS\CofAs\10300_081210C01_SUN2.pdf")
I look at the PageHeight and PageWidth and it shows 3230 and 2475. I have no idea of what those numbers are. I doubt if they are the 72 points per inch.
After using DrawText to put text onto the page and printing it, the text inserted prints so small that i needed a magnifying glass to read it. I had to increase the text size to 48 to make it print a legible line of text about the size of a 12 point.
Does anybody know how to work with a loaded PDF file and use standard font sizes and standard page sizes?
Any help would be gratefully appreciated.
Thanks,
Tony Edited by Carneno - 21 Apr 11 at 7:23PM |
|
|
Stop The World, I want To Get Off.
|
|
![]() |
|
Rowan
Moderator Group
Joined: 10 Jan 09 Status: Offline Points: 398 |
Post Options
Thanks(0)
Quote Reply
Posted: 22 Apr 11 at 11:21AM |
|
Hi Tony,
The 3230 and 2475 sizes are likely correct. It's likely that the page size of your document is just quite big and thus the seemingly strange results with DrawText. The default measurement unit used in PDF is a point. More info about points here. You can change the measurement unit to mm or inches using the SetMeasurementUnits function. If you upload your PDF somewhere and post a link we can check to see if the page size returned is correct. Cheers, - Rowan.
|
|
![]() |
|
Carneno
Team Player
Joined: 19 Apr 11 Status: Offline Points: 24 |
Post Options
Thanks(0)
Quote Reply
Posted: 22 Apr 11 at 1:22PM |
|
Hello Rowan. Thanks for your help. One thing I forgot to mention is that the PDF I am working with was converted from a TIFF file using QuickPDF. It's a two page document that prints on letter size paper. Here is the code I used: QuickPDFTiffImagePages = QuickPDFObject.GetImagePageCount("C:\Dataflow\TiffBase\BOLDUP1.TIF") For i = 1 To QuickPDFTiffImagePages QuickPDFDocumentID = QuickPDFObject.AddImageFromFile("C:\Dataflow\TiffBase\BOLDUP1.TIF", i) QuickPDFResult = QuickPDFObject.SaveToFile("C:\CoyneEDMS\PDF\DeliveryTicket.pdf") After conversion, the PDF has a height and width of 3296 and 2500. I looked at the properties of the input TIFF file and it has the same measurements in pixels with a 300DPI. So, I have to assume the numbers I am getting from QuickPDF after loading in the converted PDF file are pixels. Should I continue to work with it that way? If I change the measurement unit and work with it, then save the PDF after adding text to it, will it save it correctly so that it will print OK? Where can I upload a file for you to look at it? I can send you both the TIFF and PDF files. Thanks for all of your help. Tony Edited by Carneno - 22 Apr 11 at 2:03PM |
|
|
Stop The World, I want To Get Off.
|
|
![]() |
|
Carneno
Team Player
Joined: 19 Apr 11 Status: Offline Points: 24 |
Post Options
Thanks(0)
Quote Reply
Posted: 22 Apr 11 at 8:09PM |
|
Rowan,
I tried setting the measurements unit to 0 and that did not help. It still prints very tiny for a SetTextSize setting of 10.
I aslo tried setting the measurements unit to 2.
Thanks ,
Tony Edited by Carneno - 22 Apr 11 at 8:15PM |
|
|
Stop The World, I want To Get Off.
|
|
![]() |
|
Rowan
Moderator Group
Joined: 10 Jan 09 Status: Offline Points: 398 |
Post Options
Thanks(0)
Quote Reply
Posted: 23 Apr 11 at 9:46AM |
|
Hi Tony,
If you email the files to us at support (at) quickpdflibrary.com then we can take a look at them. Instead of the DrawImage function you might find the FitImage function is what you are looking for. If you image is really 3296 x 2500 then it won't fit onto a Letter size page, so you'll want to scale the image down. The FitImage function allows you to draw a scaled image in a specified area with the aspect ratio of the image being preserved. Cheers, - Rowan. |
|
![]() |
|
Carneno
Team Player
Joined: 19 Apr 11 Status: Offline Points: 24 |
Post Options
Thanks(0)
Quote Reply
Posted: 23 Apr 11 at 4:29PM |
|
Hello Rowan.
I sent the files to Andrew in customer service and he helped me create a formula to fix the problem.
Here is the code that Andrew helped me with to convert the TIFF images.
Private Sub Convert_TIFF_To_PDF(ByVal SavedPDFFile As String, ByVal LoadedPDFFile As String) QuickPDFTiffImagePages = QuickPDFObject.GetImagePageCount(LoadedPDFFile) For i = 1 To QuickPDFTiffImagePages If Not i = 1 Then QuickPDFResult = QuickPDFObject.NewPage End If QuickPDFResult = QuickPDFObject.SetOrigin(1) QuickPDFDocumentID = QuickPDFObject.AddImageFromFile(LoadedPDFFile, i) QuickPDFHorizontalResolution = QuickPDFObject.ImageHorizontalResolution QuickPDFTiffImageWidth = QuickPDFObject.ImageWidth / QuickPDFHorizontalResolution * 72 QuickPDFTiffImageHeight = QuickPDFObject.ImageHeight / QuickPDFHorizontalResolution * 72 QuickPDFResult = QuickPDFObject.SetPageDimensions(QuickPDFTiffImageWidth, QuickPDFTiffImageHeight) QuickPDFResult = QuickPDFObject.DrawImage(0, 0, QuickPDFTiffImageWidth, QuickPDFTiffImageHeight) Next QuickPDFResult = QuickPDFObject.SaveToFile(SavedPDFFile) QuickPDFResult = QuickPDFObject.RemoveDocument(QuickPDFObject.SelectedDocument) End Sub
This works just fine for my purposes.
Thanks for all of your suggestions and help.
Tony
|
|
|
Stop The World, I want To Get Off.
|
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store