Proper tools for modifying PDF ?

This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-Tools SDK of Library DLL functions(only) - Please use the PDF-XChange Drivers API SDK Forum for assistance with all PDF Print Driver related topics.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Sean - Tracker, Chris - Tracker Supp, Tracker Supp-Stefan, Ivan - Tracker Software, Andrew - Tracker Support, Tracker - Clarion Support, John - Tracker Supp, Support Staff, moderators

Post Reply
WayneH
User
Posts: 85
Joined: Mon May 21, 2007 5:39 pm

Proper tools for modifying PDF ?

Post by WayneH » Thu Jul 12, 2007 10:08 pm

Can you please tell me what the proper developer tools would be to open and modify an existing PDF?

Do you have an example of this (VB) ?

I'd like to:
-open an existing pdf
-scale it / rotate it to fit a different page size
-add Text and Watermark (like PXC_AddWatermark and PXC_TextOutA)
-perhaps change the PDF metadata / version (1.4, 1.5, etc)
-save it back to PDF


Thanks as always....
Last edited by WayneH on Thu Jul 12, 2007 10:11 pm, edited 1 time in total.

John - Tracker Supp
Site Admin
Posts: 8202
Joined: Tue Jun 29, 2004 10:34 am
Location: Vancouver Island - Canada
Contact:

Post by John - Tracker Supp » Thu Jul 12, 2007 10:10 pm

Hi Wayne,

the PDF-Tools SDK is the correct tool for all the items mentioned.

also there are a couple of recent threads here discussing how to 're-scale' a PDF.

e.g. :

http://www.tracker-software.com/forum/v ... php?t=2863

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

WayneH
User
Posts: 85
Joined: Mon May 21, 2007 5:39 pm

Post by WayneH » Thu Jul 12, 2007 10:19 pm

I'm not sure which "tool" to use to open an existing PDF.

If I open the PDF with the Viewer SDK (PXCV_ReadDocumentW),
how do I add a watermark and save it?

Do I need to use the DrawPageToDC, then modify it with PXC, then save it with PXC ?

Is it better to use the new Viewer ActiveX?

Ivan - Tracker Software
Site Admin
Posts: 3609
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Post by Ivan - Tracker Software » Fri Jul 13, 2007 7:18 am

You don't need to use Viewer's SDK.
What is needed for you -- PRO SDK (PXCp_XXX functions) and PDF-XChange SDK (PXC_XXX functions)
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.

John - Tracker Supp
Site Admin
Posts: 8202
Joined: Tue Jun 29, 2004 10:34 am
Location: Vancouver Island - Canada
Contact:

Post by John - Tracker Supp » Fri Jul 13, 2007 7:20 am

Hi Wayne,

The Viewer Ax will not provide the functionality required - you need to use the functions available in the XCPRO35.dll and library - this is the primary library for PDF modification and will provide all the functions outlined - hence the reason for pointing you at this previous forum message :

http://www.tracker-software.com/forum/v ... php?t=2863

The above deals with scaling specifically - to see what functions you need for your other desired changes - please see the XCPro35Help.chm which lists all the functions available - e.g:

PXCp_AddWatermark
PXCp_SetSpecVersion
PXCp_PageSetRotate

all of which are High level API calls - I would suggest that unless you are a PDF 'Guru' you ignore the Low Level API functions -as we do not provide support/help for Low Level API functionality - its very complex and not intended for use by anyone that is not extremely familiar with the PDF format, Adobe's PDF reference manual and accepts the consequences of using the very powerful - but if misused - highly dangerous functions.

Also if you take a look at the example app's provided some of the functionality you require is shown - such as page rotation, watermarks and setting the PDF version.

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

WayneH
User
Posts: 85
Joined: Mon May 21, 2007 5:39 pm

Post by WayneH » Fri Jul 13, 2007 6:27 pm

I seem to be having some problems, in that neither the XCPRO35.dll nor the pxclib30.dll each have all the functions that I need.

For example, I use XCPro to open the PDF, but I need to use PXC to add text.

The code below fails at PXC_GetPage...

Code: Select all

    Dim pc As Long
    Dim xWid As Double
    Dim xHite As Double
    Dim mypdf as Long
    Dim dummy as Long
    Dim fileName as String
    fileName="C:\Sample.pdf"
    dummy = PXCp_Init(mypdf, "<YOUR REG KEY>", "<YOUR DEV CODE>")
    dummy = PXCpVB_ReadDocumentW(mypdf, fileName, 0)
    DoEvents
    dummy = PXCp_GetPagesCount(mypdf, pc)
    If dummy <> 0 Then
        IS_DS_FAILED (dummy)
        ShowDSErrorString dummy
        PXC_ReleaseDocument mypdf
        Exit Sub
    End If
    For i = 0 To pc - 1
        dummy = PXC_GetPage(mypdf, i, page)
        If dummy <> 0 Then
            IS_DS_FAILED (dummy)
            ShowDSErrorString dummy
            PXC_ReleaseDocument mypdf
            Exit Sub
        End If
        dummy = PXC_GetPageSize(page, xWid, xHite)
        If dummy <> 0 Then
            IS_DS_FAILED (dummy)
            ShowDSErrorString dummy
            PXC_ReleaseDocument mypdf
            Exit Sub
        End If
        ' at this point I want to add a Watermark using: PXC_AddWatermark
        ' and some text using: PXC_TextOutA for which I need the Page address
        ' which I already have working properly in another piece of code
        ' the text and watermark will vary per page
    Next i
    dummy = PXCpVB_WriteDocumentW(mypdf, fileName, PXCp_CreationDisposition_Overwrite, PXCp_Write_Release)
    If dummy <> 0 Then
        IS_DS_FAILED (dummy)
        ShowDSErrorString dummy
        PXC_ReleaseDocument mypdf
        Exit Sub
    End If
Thanks for your help.
Attachments
Sample.zip
(15.51 KiB) Downloaded 161 times

John - Tracker Supp
Site Admin
Posts: 8202
Joined: Tue Jun 29, 2004 10:34 am
Location: Vancouver Island - Canada
Contact:

Post by John - Tracker Supp » Fri Jul 13, 2007 7:27 pm

The PXCLIB30.DLL is only for use creating new PDF pages/files.

You can only use the xcpro35 library when modifying an existing PDF page/ file.

The ONLY PRACTICAL way to add to text to an existing PDF is to apply it as a text watermark.

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

WayneH
User
Posts: 85
Joined: Mon May 21, 2007 5:39 pm

Post by WayneH » Fri Jul 13, 2007 9:17 pm

I want to be sure then:

If I need to add text to an existing PDF in MULTIPLE LOCATIONS, I can use the Watermark method, changing the parameters, and applying multiple times - correct?

Thanks again.

Ivan - Tracker Software
Site Admin
Posts: 3609
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Post by Ivan - Tracker Software » Sat Jul 14, 2007 8:55 am

Hi,

No, in this case there is one more method which may well work better for you:

You can create new document with text positioned as required using the PDFXCLIB30.DLL functions (PXC_XXX) and then 'overlay' this onto the existing pages in the other file - this will also have the benefit of creating a smaller file if the overlay page is common to all the pages in the file you will impose it on to - as only one extra page is added to the file - despite the fact it is used several times.

HTH
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.

WayneH
User
Posts: 85
Joined: Mon May 21, 2007 5:39 pm

Post by WayneH » Sat Jul 14, 2007 12:52 pm

Ivan -

Why do you think would work better than multiple 'watermarks' ?

Also, am I correct in understanding that there is no equivalent method to PXC_TextOutA within XCPRO35.dll ?
I've already got that working the way I need it when I create a PDF from another source - I'd like to re-use it when I have to work with existing PDFs.

Ivan - Tracker Software
Site Admin
Posts: 3609
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Post by Ivan - Tracker Software » Sat Jul 14, 2007 2:33 pm

it it better than 'watermarks' because it is more flexible. for example, you are not limited just with text, but can use any drawings.

Yes, for now XCPRO35 doesn't support such type of modification of an existing PDF. Our upgrade to the SDK later this year, will merge all our library functions into a single library and allow their use when working with new or existing PDF pages/files - creation, manipulation, etc.
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.

WayneH
User
Posts: 85
Joined: Mon May 21, 2007 5:39 pm

Post by WayneH » Sat Jul 14, 2007 2:55 pm

So, even though you said the new SDk is not in development, do you have an estimate of when it may be released?

Ivan - Tracker Software
Site Admin
Posts: 3609
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Post by Ivan - Tracker Software » Sat Jul 14, 2007 3:39 pm

Not so soon. We are planning to release it at the end of this year.
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.

WayneH
User
Posts: 85
Joined: Mon May 21, 2007 5:39 pm

Post by WayneH » Sat Jul 14, 2007 4:02 pm

Do you know how upgrades from other purchases will work yet?

Say, from PDFTools3 SDK?

Ivan - Tracker Software
Site Admin
Posts: 3609
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Post by Ivan - Tracker Software » Sun Jul 15, 2007 8:53 am

Please send your request to sales@tracker-software.com
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.

Post Reply