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 - Different results with similar pdf's
  FAQ FAQ  Forum Search   Register Register  Login Login

Different results with similar pdf's

 Post Reply Post Reply
Author
Message
ezaidi View Drop Down
Beginner
Beginner
Avatar

Joined: 19 May 11
Location: Montreal
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote ezaidi Quote  Post ReplyReply Direct Link To This Post Topic: Different results with similar pdf's
    Posted: 19 May 11 at 3:54PM
Hi I am trying to stamp some pdf files with an overlay, however I seem to be getting different results when creating the stamp on a pdf file generated through autocad with the pdfplot10.hdi 10.0.55.0 driver. All other distiller created pdf's are fine. Here are links to the files I used. Two files are of same height and width and one is a png overlay file.

http://uploading.com/files/31ac5971/Pdf_overlay_problem.zip/

Here is the code I use:

Call QP.SelectPage(I)
            
Rem create a new layer to apply the stamp on and select it
Call QP.NewLayer
Call QP.SelectLayer(QP.LayerCount)                     
                     
Rem set the transarency of the image
Call QP.SetTransparency(40)
                     
Rem Set scale based on Page Ht value
If QP.PageWidth < QP.PageHeight Then
    mScale = QP.PageWidth * 0.8 / 800
Else
    mScale = QP.PageHeight * 0.8 / 800
End If
Call QP.SetScale(mScale)                  

mStampLeft = (QP.PageWidth - QP.ImageWidth) / 2
mStampBot = QP.PageHeight - 10 - QP.ImageHeight
     
Call QP.DrawRotatedImage(mStampLeft, mStampBot, QP.ImageWidth, QP.ImageHeight, 0)

QP.SaveToFile(GetWinDirectories("TempDir") & "Temp.pdf")


Please let me know if this can be fixed.

Thanks!
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3530
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 11 at 7:28PM
Hi Ezaidi!

I've thought there was a stamp (the png in the zip) on both pdf?
I don't find a stamp on both pdf. Nothing.
So i don't know where's the problem but i can imagine ... ;-)
I don't see a GetOrigin in your code ...
Please read all about SetOrigin and GetOrigin in the online reference:
http://www.quickpdflibrary.com/help/quickpdf/MeasurementAndCoordinateUnits.php
Normally the highest pixel-row is at the top and the lowest is at the bottom but you can't be sure so have a look on SetOrigin and GetOrigin.

Cheers and welcome here,
Ingo

Back to Top
ezaidi View Drop Down
Beginner
Beginner
Avatar

Joined: 19 May 11
Location: Montreal
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote ezaidi Quote  Post ReplyReply Direct Link To This Post Posted: 20 May 11 at 2:10PM
Hi, I gave the pdf's which have not yet had an overlay stamped. If you run the code I use, you will see that the stamp will yield different results on both pdf's. The getorigin function seems to always give me 0 on either pdf.

Thank you for your help
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3530
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 20 May 11 at 3:05PM
Hi!

This here is only a user-user-forum here.
Your code isn't pascal/delphi (my favourite) and it's not a complete project.
So there won't be anybody who can try your code in a quick way.
You should investigate in things having to do with "rotation".
If origin is 0 but one page is rotated (and it is!) after creation then your stamp goes into nothing ;-)
Open the files with notepad and search for "rotate"...
Try other values using the "bad" pdf...
You can try the official knowledgebase in this case, too.

Cheers, Ingo



Back to Top
ezaidi View Drop Down
Beginner
Beginner
Avatar

Joined: 19 May 11
Location: Montreal
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote ezaidi Quote  Post ReplyReply Direct Link To This Post Posted: 20 May 11 at 9:01PM
Hi, I dont think this has to do with rotation. What seems to be going on is the page size scaling. When I use the pagewidth and height methods, I get 1000 and 1545 respectively on both good and bad pdf's. I use these sizes to decide where my stamp will go. The problem is on the bad pdf, my stamp appears minuscule and completely away from where it should be placed. I also noticed that in order to get my stamp to appear at the right place I have to multiply everything by a factor of 8. For example this works:

Call QP.DrawRotatedImage(mStampLeft * 8, mStampBot * 8, QP.ImageWidth * 8, QP.ImageHeight * 8, Rotation)

Why is there a factor of 8 needed yet the page height and width are the same, the rotation is the same. The only discernible difference is that one pdf was generated with pdfplot10.hdi through autocad and one pdf is generated with distiller (which gives good results)

Let me know if you have any understanding about the scaling that is occurring.
Back to Top
Rallsolo View Drop Down
Beginner
Beginner


Joined: 24 Sep 08
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rallsolo Quote  Post ReplyReply Direct Link To This Post Posted: 22 May 11 at 2:28AM
I've seen this before in PDFs created from different sources.  It has to do with the resolution of the original images placed on the PDFs.  One way you can automate the scale is to check the string returned by QP.GetInformation(6) which will give you who created the PDF.  If it says pdfplot, automatically multiply by 8.  Either that or play with the resolution in AutoCAD when you produce the plot if you can.
Back to Top
ezaidi View Drop Down
Beginner
Beginner
Avatar

Joined: 19 May 11
Location: Montreal
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote ezaidi Quote  Post ReplyReply Direct Link To This Post Posted: 24 May 11 at 1:06PM
That is exactly what i have done. In my new code I use qp.getinformation(6) and check for pdfplot and then scale by 8. It seems to work well but im still confused as to why pagewidth and pageheight functions give the unscaled resolution. I dont know if this is a bug with quickpdf or what. I would have liked to keep my code clean and have a general solution which works with all pdf versions. Unfortunately, the function which generates the pdf's in autocad does not have any configurations to play with the resolution.

I guess we will have to live with this.

Thanks for your help guys
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