Hi - After some initially successful hello-world type experimentation, I ran into a problem with Append. I tried to extend podofomerge to handle a list of files (not limited to 2), and it doesn't work. That is, the program runs to completion, and generates an output file, but that output file looks corrupt.
Could someone here (who is not such a complete PoDoFo novice like I am) try the attached code, and try to figure out where the problem is? I'll certainly keep investigating here, but I'm still somewhat in the dark about how this stuff is supposed to work. I am using svn trunk as downloaded a couple of days ago. - Larry
/*************************************************************************** * (Derived from, podofomerge, which is:) * * Copyright (C) 2006 by Dominik Seichter * * [email protected] * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include <podofo/podofo.h> #include <stdlib.h> using namespace PoDoFo; void print_help() { printf("Usage: ixmerge [inputfile1 [.. inputfile2]] [outputfile]\n\n"); } int main( int argc, char* argv[] ) { int argp; if( argc < 3 ) { print_help(); exit( -1 ); } try { printf("Reading file: %s\n", argv[1]); PdfMemDocument input1( argv[1] ); for (argp=2; argp<argc-1; argp++) { printf("Reading file: %s\n", argv[argp] ); PdfMemDocument *input2 = new PdfMemDocument( argv[argp] ); printf("Appending %i pages on a document with %i pages.\n", input2->GetPageCount(), input1.GetPageCount() ); input1.Append( *input2 ); } input1.SetPageMode( ePdfPageModeUseBookmarks ); input1.SetHideToolbar(); input1.SetPageLayout( ePdfPageLayoutTwoColumnLeft ); printf("Writing file: %s\n", argv[argc-1] ); input1.Write( argv[argc-1] ); } catch( PdfError & e ) { fprintf( stderr, "Error %i occurred!\n", e.GetError() ); e.PrintErrorMsg(); return e.GetError(); } return 0; }
------------------------------------------------------------------------------
_______________________________________________ Podofo-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/podofo-users
