How to reopen a TPDF?

Hi guys,

I am a bit curious about the usage of TPDF. I do have a code generating each time a PDF file.
Therefore I would like to relopen and add a page and close. Is it possible with the current version of ROOT ?


As I would like to merge files basically, I started by installing the PoDoFo library (maybe not the best library? i don’t have any feedback yet) and ran podofomerge as example but it seems there are some issue. (I don’t have the issue while merging 2 pdf files not created with root) Does someone has a guess about this:

Reading file: hist-1_0.pdf
<</Info 2 0 R/Root 1 0 R/Size 107>>
Reading file: hist-1_1.pdf
<</Info 2 0 R/Root 1 0 R/Size 107>>
Appending 14 pages on a document with 14 pages.
Fixing references in 107 0 R by 106
Fixing references in 108 0 R by 106
Fixing references in 109 0 R by 106
Fixing references in 110 0 R by 106
Fixing references in 111 0 R by 106
Error 16 occurred!

PoDoFo encountered an error. Error: 16 ePdfError_NoObject
   Error Description: A object was expected but not found.
   #0 Error Source: /home/marcomeyer/Compass/escalade/escalade-build/src/libpodofo/src/base/PdfParserObject.cpp:233
   	Information: 4

NB: The goal is then to elaborate a c++ code in order to merge on the fly.

With ROOT you can create PDF with several pages but there is no way to reopen a file and add new pages. You should use external tools for that. OR save your pages (canvases) in ROOT files, not in PDF files.

I finally figured out using gSystem->Exec and the following shell command :

gs -dBATCH -dNOPAUSE -dDOPDFMARKS=true -sDEVICE=pdfwrite -sOutputFile=out.pdf in1.pdf in2.pdf

Hi Couet,

I just noticed that for some reason that I don’t understand ROOT stop executing my shell commands sent from TSystem::Exec.

Is there any kind of explanation for that ? I had to reboot my computer in order to make it work again… :frowning:

No I have no answer. It is difficult to tell what went wrong without more information.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.