I am working with an established application where PDFReactor 5.1 is in use. The company will not upgrade it for a while (maybe another 1-2 years).
I was tasked with building functionality to merge pdf files (a appending all pdfs will do) from a C# based web application.
Reading though the old docs of this tool (which are from 2012) I have found they propose this type of usage:
To merge multiple PDFs use the methods setMergeURLs or setMergeByteArrays
String[] urls = {"http://www.myserver.com/overlaid1.pdf", "http://www.myserver.com/overlaid2.pdf"}; pdfReactor.setMergeURLs(urls); pdfReactor.setMergeMode(PDFreactor.MERGE_MODE_APPEND);
However, the documentation does not specify what method to call to render the merged pdf and setMergeURLs does not return a value (public void SetMergeURLs(string[] urls))
I can see there are 3 render methods, when I explore the client DLL, but all of them require some input (presumably in addition to the pdf you set with setMergeURLs):
public byte[] RenderDocumentFromByteArray(byte[] byteArray)public byte[] RenderDocumentFromContent(string content)byte[] RenderDocumentFromURL(string URL)
I tried using these 3 render methods but they only result on an empty array with the following error:
org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
it seems PDF reactor is trying to do a conversion from XML to pdf instead of the merge...
what am I missing??
I spoke with RealObjects's Support (pdf reactor's creator) and this is their answer:
This FAQ looks like intended for the current version only, so it does not really help with the usage of version 5.1 (as I require).
I kept trying a little more until I finally got it to merge. This is the main part of it:
The
merged.pdffile contains the other two files however it is started with a blank page (due to the<html></html>I had it use on theRenderDocumentFromContentcall to make it not produce errors).That is as far as this exercise will go for me, I will leave it at that and consider another tool to do pdf merging, as I wouldn't want this blank page around.