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!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Not sure of how to work with loaded pdf file
  FAQ FAQ  Forum Search   Register Register  Login Login

Not sure of how to work with loaded pdf file

 Post Reply Post Reply
Author
Message
Carneno View Drop Down
Team Player
Team Player
Avatar

Joined: 19 Apr 11
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote Carneno Quote  Post ReplyReply Direct Link To This Post Topic: Not sure of how to work with loaded pdf file
    Posted: 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.
Back to Top
Rowan View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 10 Jan 09
Status: Offline
Points: 398
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rowan Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Carneno View Drop Down
Team Player
Team Player
Avatar

Joined: 19 Apr 11
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote Carneno Quote  Post ReplyReply Direct Link To This Post 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)
QuickPDFTiffImageWidth = QuickPDFObject.ImageWidth
QuickPDFTiffImageHeight = QuickPDFObject.ImageHeight
QuickPDFResult = QuickPDFObject.SetPageDimensions(QuickPDFTiffImageWidth, QuickPDFTiffImageHeight)
QuickPDFResult = QuickPDFObject.DrawImage(0, QuickPDFTiffImageHeight, QuickPDFTiffImageWidth, QuickPDFTiffImageHeight)
            If Not i = QuickPDFTiffImagePages Then
                        QuickPDFResult = QuickPDFObject.NewPage
            End If
Next

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.
Back to Top
Carneno View Drop Down
Team Player
Team Player
Avatar

Joined: 19 Apr 11
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote Carneno Quote  Post ReplyReply Direct Link To This Post 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.
 
Should I just live with it and work with a pixel factor?  Or am I doing something wrong?
 
Thanks ,
Tony


Edited by Carneno - 22 Apr 11 at 8:15PM
Stop The World, I want To Get Off.
Back to Top
Rowan View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 10 Jan 09
Status: Offline
Points: 398
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rowan Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Carneno View Drop Down
Team Player
Team Player
Avatar

Joined: 19 Apr 11
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote Carneno Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store