[xep-support] How to generate PDF from XEPOUT files?

Kevin Brown kevin at renderx.com
Thu Jan 21 17:07:18 PST 2010


Allan:

There are two sides to this. As the white paper describes, VDPMill which is
a ($) application from RenderX does all of this already (and much, much
more). Or we can offline explain to some degree assist you with how you can
call XEP in Java to execute the RenderX backend for your particular
application.

As a customer of RenderX, you can look into the developer's kit
"ConcatFormatter" example for what you are looking for -- how to call only
the RenderX backend with an XEP file. If you are using XEPWin, it's not so
simple as the methods are not exposed. If you are concatenating and building
your own XEP intermediate file externally, you can just send it as XEP
format to XEPWin.

However, the most effective and efficient integration of this is our own
solution - VDPMill. This is why we built the application in the first place.
It reaches deeper than you can ever do and allows for streamed input/output
of content formatting through the engine. And during this initial pre-sales
period, it is of little cost to our customers.

Kevin Brown
RenderX
(650) 327-1000

-----Original Message-----
From: owner-xep-support at renderx.com [mailto:owner-xep-support at renderx.com]
On Behalf Of Williams, Allan Derrick
Sent: Thursday, January 21, 2010 4:11 PM
To: 'xep-support at renderx.com'
Subject: [xep-support] How to generate PDF from XEPOUT files?


Hi-

I'm new to RenderX and I apologize if I am asking something that has been
rehashed many times, I may have overlooked the answer from the archives.
Pointers to resolved answers gratefully accepted!

My problem is that I need to make enormous PDFs in the tens of thousands of
pages, possibly more in Java. (The 'why' is out of my hands. I'm only tasked
with the 'how').

I found this document that was bang on to helping me solve my problem:

http://renderx.net/documents/RenderX_Large_Reports_Formatting.pdf

The steps this document outlines are roughly this:

1) Transform your document: XML+XSL -> XSL:FO piecemeal (for example, 100
pages per file)
2) Format your document: XSL:FO -> XEPOUT  (merge the XEPOUT files as
detailed in document)
3) Generate your pdf files:  XEPOUT -> PDF  (memory efficient this way)


I've accomplished steps 1 and 2, but I'm stuck at #3. The above document
doesn't really get very technically detailed (basically says 'this exercise
is left to the reader', etc).

Here's how I did Steps 1 and 2 (Java code fragment):

 StreamSource myConfigSource = 
    new StreamSource(new File("D:\\derrick\\renderxx\\xep.xml"));
 StreamSource myInputSource = 
    new StreamSource(new File("D:\\derrick\\renderxx\\C2Big_1.xml"));
 StreamSource myStyleSource = 
    new StreamSource(new File("D:\\derrick\\renderxx\\C2.xsl"));
		
 FormatterImpl myFormat = new FormatterImpl(myConfigSource);
 FOTransformer  myTransformer = 
      new FOTransformer(myStyleSource,myFormat,new DefaultLogger());
 FileOutputStream	myOutput = 
      new FileOutputStream(new File("D:\\derrick\\renderxx\\C2.xep"));
 FOTarget myTarget = 
      new FOTarget(myOutput, "xep"); 

 myTransformer.transform(myInputSource, myTarget);

This works great, I get the C2.xep file, but for the life of me I can't
figure out the code to go from XEPOUT->PDF in a similar way as above. The
FOTarget class seems to only want to deal with XSL:FO files. I guess there
is a really good reason why FOTransformer has the prefix 'FO', but still.

Is there a class I can use to transform XEPOUT to PDF, similar to the above
code fragment?

Note: I am not completely stuck on #3, I was able to accomplish the
XEPOUT->PDF step this way:

	
String parameters[]={"-DCONFIG=D:\\derrick\\renderxx\\xep.xml",
                     "-xep","D:\\derrick\\renderxx\\C2.xep",
                      "-pdf","D:\\derrick\\renderxx\\C2.pdf"};

XSLDriver.main(parameters);


However I've found XSLDriver to be clumsy - it calls System.exit(), which is
a nuisance if you're writing an always-on application like a web service.
Your code terminates when you call XSLDriver, never mind that you have other
things to do after XSLDriver's done. I guess I could just kick off another
process calling XSLDriver but surely there is a better way. I really like
the FOTransformer class because I can stream data from various sources.
XSLDriver deals only with physical files - somewhat inconvenient in my
application.

Thanks very much for reading this far - I hope I didn't go overly long and
truly appreciate any help!

-Derrick





-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo at renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service
http://www.renderx.com/terms-of-service.html

-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo at renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/terms-of-service.html



More information about the Xep-support mailing list