I was updating my application with the latest gdpicture control 5.10.0 and found a problem with the ImageHeight and ImageWidth properties of the viewer control (this was working correctly prior to my installing this update).
I have a multipage pdf file, before printing i check the size to determine which paper tray to use. the first page reads the ImageHeight and ImageWidth correctly, however all remaining pages return the wrong results for these properties - it's a legal size document but it's showing 13 for the width and 22 for the height when it should be 935 x 1540.
Once again, the properties on the first page of the pdf read 935 x 1540, the remaining pages read 13 x 22. I verfied that the pdf file displays correctly in Adobe Reader, nothing unusual about it. i'm using VFP9.0
After a bit of troubleshooting I found that the PrintImage() function is what's messing things up. if i comment this line out, it reads each page correctly. If I add the line back in, the ImageHeight and ImageWidth return incorrect values.
here is a sample of the code i'm using.
- Code: Select all
lcPrinter = SET("printer",2)
o = CREATEOBJECT("gdPicturePro5.GdViewer")
o.SetLicenseNumber(GD_LICENSE)
lnReturn = o.PrintSetActivePrinter(lcPrinter)
** make sure it doesn't autorotate
o.PrintSetAutoRotation(.F.)
o.PdfDPIRendering = 110
o.PdfRenderingMode = 2
lcImageFile = "c:\pdf_test\print_test.pdf"
lnReturn = o.DisplayFromPdfFile(lcImageFile)
lnPgCount = o.PageCount
FOR i = 1 TO lnPgCount
lnReturn = o.Displayframe(i)
lnHeight = o.ImageHeight
lnWidth = o.ImageWidth
lnPaperTray = 5
lnReturn = o.PrintSetStdPaperSize(lnPaperTray)
o.PrintSetOrientation(1)
o.PrintSetFromToPage(i, i)
o.PrintImage() && comment this line out and it returns the correct height and width
ENDFOR
o.CloseImage
