Problem using ConcatenateFiles

If you are a Power Builder developer and have any questions about using our products from Power Builder here is the place to post them.
Post Reply
emarchy
Posts: 2
Joined: Tue Aug 19 2008

Problem using ConcatenateFiles

Post by emarchy » Mon Mar 09 2009

Amyuni PDF Converter version 3.03
PowerBuilder 10.2.1
EAServer 5.5
--------------------
Hi,

I am trying to generate a single PDF from two PDFs previously generated by Amyuni PDF Converter, using the DLL.
I have a Powerbuilder NVO component that reside in EAServer with the following local external function declared as:

Function boolean ConcatenateFiles( string inputFile1, string inputFile2, string outputFile) LIBRARY "cdintf300.dll"

I am trying to concatenate using the Amyuni ConcatenatFile function with logic bellow but it always returns false. I've
included a summary of the events and methods I'm using. I've tried numerous scenarios to no avail. Any help would be appreciated!

Thanks
Eric

// Logic being used to concatenate two PDF generated thru AMYUNI Converter

ls_main_file = "c:\consolidate\main.pdf" // Previously generated with AMYUNI
ls_second_file = "c:\consolidate\second.pdf" // Previously generated with AMYUNI
ls_concatenated_file_output = "c:\consolidate\output.pdf"

an_amyuni_driver.of_lock(ls_concatenated_file_output)
an_amyuni_driver.of_concatenate(ls_main_file, ls_second_file, ls_concatenated_file_output) //See bellow for logic
an_amyuni_driver.of_unlock(ls_concatenated_file_output)


//***********************************************************
//Constructor event
...
PDFPrinter = DriverInit("Amyuni PDF Converter")
IF PDFPrinter < 1 THEN
...
END IF
li_rc = SetResolution (PDFPrinter, 600)
IF li_rc <> 1 THEN
...
END IF
li_rc = SetDefaultConfigEx(PDFPrinter)
IF li_rc <> 1 THEN
...
END IF
SetDefaultPrinter(PDFPrinter)

//***********************************************************
// of_lock(as_document_title) method

ll_rc = Lock(PDFPrinter, as_document_title)
IF ll_rc <> 0 THEN
...
END IF
ll_rc = SetDocFileProps ( &
PDFPrinter, &
as_document_title, &
NoPrompt + EmbedFonts + UseFileName + Concatenate, &
"", &
"")
IF ll_rc <> 0 THEN
...
END IF
ll_rc = EnablePrinter(PDFPrinter, AmyuniLicense, AmyuniActivationCode)
IF ll_rc <> 1 THEN
...
END IF

//*****************
// of_unlock(as_document_title) method
ll_rc = UnLock(PDFPrinter, as_document_title, 1000)
IF ll_rc <> 0 THEN
...
END IF

SetFileNameOptions (PDFPrinter, 0)

//***********************************************************
//Destructor event
IF PDFPrinter > 0 THEN
DriverEnd (PDFPrinter)
END IF

//***********************************************************
// of_concatenate(as_main_file, as_second_file, as_concatenated_file)

lb_response = ConcatenateFiles(as_main_file, as_second_file, as_concatenated_file)
IF lb_response = False THEN
...
RETURN
END IF

Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Re: Problem using ConcatenateFiles

Post by Joan » Fri Mar 13 2009

Hello,

I am not sure why you are calling Lock() and Unlock() functions.

You just need to call 1 function: ConcatenateFiles(File1, File2,File3).

File1 and File2 should be pdf files already existing in the system (not being generated in the process). File3 is the output file.
Custom Brand the Amyuni PDF Printer Driver http://www.amyuni.com/en/developer/branding/index.html

Amyuni PDF Converter tested for true PDF performance. View results - http://www.amyuni.com/benchmark

emarchy
Posts: 2
Joined: Tue Aug 19 2008

Re: Problem using ConcatenateFiles

Post by emarchy » Fri Mar 13 2009

Hi Joan,

Thanks for replying.

I removed the Lock and Unlock from within my of_lock and of_unlock methods. I still left the SetDocFileProps with the Concatenate option. My latest try still returns false. Does the output file need to exist in advance?

We have been using AMYUNI PDF Converter for 4 or 5 years with success and I was trying to use the concatenation to resolve a situations within our web app where multiple PDFs are created and need to be merged together.

Thanks for your time,
Eric

Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Re: Problem using ConcatenateFiles

Post by Joan » Mon Mar 23 2009

SetDocFileProps() is used only with the locking mechanisme (i.e while using Lock() and Unlock() functions).

Please try to remove it and use instead: SetFileNameOptions() and UseFileName()

You mentioned that your code has been working for 4-5 years now, were you using the locking functions or you add these lately?

Please note that another option would be to call the ConcantenateFiles() function in a totally different routine than the one where you are generating the pdf files.Whidh is advisable by the way. After generating the pdf files and having them on disk you can call ConcantenateFiles() only.

Hope this helps.
Custom Brand the Amyuni PDF Printer Driver http://www.amyuni.com/en/developer/branding/index.html

Amyuni PDF Converter tested for true PDF performance. View results - http://www.amyuni.com/benchmark

Post Reply