Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1691 connectés 

  FORUM HardWare.fr
  Programmation
  Java

  [pdflib] concatenation de fichiers pdf

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[pdflib] concatenation de fichiers pdf

n°1927520
gilloux
Posté le 29-09-2009 à 11:22:54  profilanswer
 

Bonjour,
 
Je souhaite concaténer des fichiers pdf en utilisant la librairie PDFLIB (et pas une autre).
 
Au niveau des API, il existe la méthode concat, mais je ne suis pas sûr qu'elle soit appropriée
 

void concat(double a, double b, double c, double d, double e, double f)
 
Apply a transformation matrix to the current coordinate system.
a, b, c, d, e, f Elements of a transformation matrix. The six values make up a matrix in
the same way as in PostScript and PDF (see references). In order to avoid degenerate
transformations, a*d must not be equal to b*c.
Details This function applies a matrix to the current coordinate system. It allows for the most
general form of transformations. Unless you are familiar with the use of transformation
matrices, the use of PDF_translate( ), PDF_scale( ), PDF_rotate( ), and PDF_skew( ) is suggested
instead of this function. The coordinate system is reset to the default coordinate
system (i.e. the current transformation matrix is the identity matrix [1, 0, 0, 1,0, 0]) at
the beginning of each page.
Scope page, pattern, template, glyph


 
en tout cas, elle n'est pas bien clair et je ne vois pas comment l'utiliser, avec cette notion de matrice...
je n'ai pas encore trouvé d'exemple intéressant  
 
y en a t'il parmi vous qui ont déjà fait de la concaténation de pdf avec cette librairie où qui ont une idée du comment ça marche ?
 
merci

mood
Publicité
Posté le 29-09-2009 à 11:22:54  profilanswer
 

n°1927538
olivthill
Posté le 29-09-2009 à 12:01:49  profilanswer
 

Malheureusement, je ne connais pas PDFLIB, mais je connais les PDF et cette matrice à 6 éléments que l'on retrouve partout. Le changement de cette matrice affecte le placement des élements et leur zoom. Cela n'a aucun rapport avec la concaténation de fichiers.
 
 

n°1927572
gilloux
Posté le 29-09-2009 à 14:00:15  profilanswer
 

ah...  
genre la méthode s'appelle concat mais ça n'a aucun rapport... zut

n°1927639
gilloux
Posté le 29-09-2009 à 15:08:35  profilanswer
 

En cours de résolution -> j'ai trouvé un exemple dans le "cookbook" sur le site www.pdflib.com
 
 

Code :
  1. /* $Id: starter_pdfmerge.java,v 1.8 2007/08/30 18:30:50 katja Exp $
  2. * PDF merge starter:
  3. * Merge pages from multiple PDF documents
  4. *
  5. * Interactive elements (e.g. bookmarks) will be dropped.
  6. *
  7. * Required software: PDFlib+PDI/PPS 7
  8. * Required data: PDF documents
  9. */
  10. package com.pdflib.cookbook.pdflib.pdf_import;
  11. import com.pdflib.pdflib;
  12. import com.pdflib.PDFlibException;
  13. public class starter_pdfmerge
  14. {
  15.     public static void main (String argv[])
  16.     {
  17.     /* This is where the data files are. Adjust as necessary. */
  18.     String searchpath = "../input";
  19.     String outfile = "starter_pdfmerge.pdf";
  20.     String title = "Starter PDF Merge";
  21.     pdflib p = null;
  22.     String pdffiles[] =
  23.     {
  24.         "PDFlib-real-world.pdf",
  25.         "PDFlib-datasheet.pdf",
  26.         "TET-datasheet.pdf",
  27.         "PLOP-datasheet.pdf",
  28.         "pCOS-datasheet.pdf"
  29.     };
  30.     int i;
  31.     try {
  32.         p = new pdflib();
  33.         p.set_parameter("SearchPath", searchpath);
  34.         /* This means we must check return values of load_font() etc. */
  35.         p.set_parameter("errorpolicy", "return" );
  36.         if (p.begin_document(outfile, "" ) == -1)
  37.         throw new Exception("Error: " + p.get_errmsg());
  38.         p.set_info("Creator", "PDFlib Cookbook" );
  39.         p.set_info("Title", title + " $Revision: 1.8 $" );
  40.         for (i=0; i < pdffiles.length; i++)
  41.         {
  42.         int indoc, endpage, pageno, page;
  43.         /* Open the input PDF */
  44.         indoc = p.open_pdi_document(pdffiles[i], "" );
  45.         if (indoc == -1)
  46.         {
  47.             System.err.println("Error: " + p.get_errmsg());
  48.             continue;
  49.         }
  50.         endpage = (int) p.pcos_get_number(indoc, "/Root/Pages/Count" );
  51.         /* Loop over all pages of the input document */
  52.         for (pageno = 1; pageno <= endpage; pageno++)
  53.         {
  54.             page = p.open_pdi_page(indoc, pageno, "" );
  55.             if (page == -1)
  56.             {
  57.             System.err.println("Error: " + p.get_errmsg());
  58.             continue;
  59.             }
  60.             /* Dummy page size; will be adjusted later */
  61.             p.begin_page_ext(10, 10, "" );
  62.             /* Create a bookmark with the file name */
  63.             if (pageno == 1)
  64.             p.create_bookmark(pdffiles[i], "" );
  65.             /* Place the imported page on the output page, and
  66.              * adjust the page size
  67.              */
  68.             p.fit_pdi_page(page, 0, 0, "adjustpage" );
  69.             p.close_pdi_page(page);
  70.             p.end_page_ext("" );
  71.         }
  72.         p.close_pdi_document(indoc);
  73.         }
  74.         p.end_document("" );
  75.         } catch (PDFlibException e) {
  76.             System.err.print("PDFlib exception occurred:\n" );
  77.             System.err.print("[" + e.get_errnum() + "] " + e.get_apiname() +
  78.                 ": " + e.get_errmsg() + "\n" );
  79.         } catch (Exception e) {
  80.             System.err.println(e.getMessage());
  81.         } finally {
  82.             if (p != null) {
  83.                 p.delete();
  84.             }
  85.         }
  86.     }
  87. }


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Java

  [pdflib] concatenation de fichiers pdf

 

Sujets relatifs
linker des fichiers objetsProbleme d'upload fichiers div ajax(c urgent)
Gestion fichiers SQL Server 2005Cacher dossiers/fichiers
problème de comparaison de deux fichiers[BASH] Concaténation
Fichiers[VBS] Comparaison de dates (résolu)
Aide script concaténation intelligente sur deux fichiers 
Plus de sujets relatifs à : [pdflib] concatenation de fichiers pdf


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR