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 - Want to create single PDF from multiple PDFs
  FAQ FAQ  Forum Search   Register Register  Login Login

Want to create single PDF from multiple PDFs

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

Joined: 16 Aug 19
Location: Maryland
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote mbabcock Quote  Post ReplyReply Direct Link To This Post Topic: Want to create single PDF from multiple PDFs
    Posted: 16 Aug 19 at 3:35PM
Source is MySource1.PDF (4 pages) and MySource2.pdf (6 pages).  
I want to create a new PDF using select pages from each of those source files.  When I look at ExtractFilePages, it gives me the impression that it will overwrite with each call (rather than append).  I'm going to test this but I was hoping somebody might steer me in the right direction before I get back to my testing.  

Thanks in advance,
--Mike

btw -- I'm using Visual FoxPro 9 SP2 for this and will be happy to share code to help others who might also be using VFP.
Back to Top
tfrost View Drop Down
Senior Member
Senior Member


Joined: 06 Sep 10
Location: UK
Status: Offline
Points: 437
Post Options Post Options   Thanks (0) Thanks(0)   Quote tfrost Quote  Post ReplyReply Direct Link To This Post Posted: 16 Aug 19 at 9:19PM
You can overlay a captured page from one of your two existing documents onto each new blank page you add to your new document.  There's an example you could adapt and convert to VFP in the sample scripts under Document Manipulation / Overlay...
Back to Top
mbabcock View Drop Down
Beginner
Beginner
Avatar

Joined: 16 Aug 19
Location: Maryland
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote mbabcock Quote  Post ReplyReply Direct Link To This Post Posted: 19 Aug 19 at 8:57PM
Scenario of documents to select (and range within it):
File: MyFile1.PDF, Range: 1  Comment: Invoice
File: MyFile1.PDF, Range: 2-4  Comment: Bill of Lading
File: MyFile2.PDF, Range: 1-3  Comment: Fuel Receipts
File: MyFile2.PDF, Range: 4-5  Comment:  Invoice
File: MyFile3.PDF, Range: 1-2  Comment: Invoice
File: MyFile3.PDF, Range: 3-12  Comment: Bill of Lading

Goal:  collect all of the Invoices into a single PDF.  

I'm wondering if it wouldn't be easier/better to export the file pages into their own PDFs using ExtractFilePagesEx("MyFile1.PDF","","MyTemp1.PDF","1",3)
ExtractFilePagesEx("MyFile2.PDF","","MyTemp2.PDF","4-5",3)
ExtractFilePagesEx("MyFile3.PDF","","MyTemp3.PDF","1-2",3)

...and then use AddToFileList and MergeFileList to take these 3 into the final MyOutput.PDF.

This is all in theory; I haven't yet tried it.  Your thoughts on that approach?


Edited by mbabcock - 19 Aug 19 at 8:59PM
Back to Top
mbabcock View Drop Down
Beginner
Beginner
Avatar

Joined: 16 Aug 19
Location: Maryland
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote mbabcock Quote  Post ReplyReply Direct Link To This Post Posted: 20 Aug 19 at 3:07AM
THIS WORKED!!!!!  I highlighted the QuickPDF lines to show the keys to successfully getting this working:

_screen.oQuickPDF.ClearFileList("MyList")
lcPath = ADDBS(ALLTRIM(_screen.cRepository)) + "temp\"
IF NOT DIRECTORY(lcPath) THEN 
MKDIR (lcPath)
ENDIF 
SELECT tmpSelected
SCAN 
SCATTER NAME loFile 
lcFile = ADDBS(lcPath)+FORCEEXT("File_" + ALLTRIM(STR(tmpSelected.iFileLinkID)) + "_" + ALLTRIM(STR(tmpSelected.iDocLinkID)) + "_" + TTOC(DATETIME(),1) + SYS(2015),'PDF')
_screen.oQuickpdf.ExtractFilePagesEx(ADDBS(ALLTRIM(loFile.cPath))+ALLTRIM(loFile.cfilename),'',lcFile,ALLTRIM(loFile.cRange),3)
_screen.oQuickPDF.AddToFileList("MyList",lcFile)
ENDSCAN
* now put the page outputs from the temp files all into the final PDF
lcFile = lcPath + "MyOutput.pdf"
_screen.oQuickPDF.MergeFileListFast("MyList",lcFile)
LaunchFile(lcFile)
USE IN SELECT('tmpSelected')



Edited by mbabcock - 20 Aug 19 at 3:09AM
Back to Top
mbabcock View Drop Down
Beginner
Beginner
Avatar

Joined: 16 Aug 19
Location: Maryland
Status: Offline
Points: 18
Post Options Post Options   Thanks (0) Thanks(0)   Quote mbabcock Quote  Post ReplyReply Direct Link To This Post Posted: 20 Aug 19 at 3:13AM
@TFrost -- do you see any drawbacks with my approach instead of the way you described?
Back to Top
tfrost View Drop Down
Senior Member
Senior Member


Joined: 06 Sep 10
Location: UK
Status: Offline
Points: 437
Post Options Post Options   Thanks (1) Thanks(1)   Quote tfrost Quote  Post ReplyReply Direct Link To This Post Posted: 20 Aug 19 at 5:35PM
If it works and you understand it and document it, those are good criteria for success!
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