IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C++Builder Discussion :

afficher un fichier PS dans une fiche


Sujet :

C++Builder

  1. #1
    Membre actif
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    385
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2006
    Messages : 385
    Points : 288
    Points
    288
    Par défaut afficher un fichier PS dans une fiche
    bonjour,

    je souhaite afficher un fichier PS dans ma forme, Est ce que c'est possible?

    j'ai pensé aux activeX d'adobe mais j'ai eu un message d'erreur en les installant.


    merci d'avance.
    « Aucun homme ne peut rien vous révéler sinon ce qui repose déjà à demi endormi dans l'aube de votre connaissance»

    « No man can reveal to you aught but that which already lies half asleep in the dawning of your knowledge »_(¯`·.__-Alg3ri4nH4ck3r-__.·´¯)_

  2. #2
    Rédacteur
    Avatar de blondelle
    Homme Profil pro
    Inscrit en
    Mars 2006
    Messages
    2 738
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 2 738
    Points : 3 766
    Points
    3 766
    Par défaut
    Salut dz_robotix
    A la suite d'une discution sur ce Post
    Voici un bout de code que j'avais teste sans aller plus loin, ici on utilise Acrobat
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
     
    //---------------------------------------------------------------------------
    #include <vcl.h>
    #pragma hdrstop
    #include "Unit1.h"
    #include <utilcls.h>
    //---------------------------------------------------------------------------
    #pragma package(smart_init)
    #pragma resource "*.dfm"
    TForm1 *Form1;
    Variant vAcrobatApp, vAcrobatPDDoc, PDDocument;
    //---------------------------------------------------------------------------
    __fastcall TForm1::TForm1(TComponent* Owner)
            : TForm(Owner)
    {
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm1::Button1Click(TObject *Sender)
    {
    // executer l'application
     vAcrobatApp = CreateOleObject("AcroExch.App");
    // executer le document
    // vAcrobatPDDoc = CreateOleObject("AcroExch.PDDoc");
     vAcrobatPDDoc = CreateOleObject("AcroExch.AVDoc");
    // ouvrir acrobat vide
     vAcrobatApp.OleFunction("Show");
    // deux facon d'ouvrir un fichier
     vAcrobatPDDoc.OleFunction("Open", "C:\\essaipdf.pdf", true);
    // vAcrobatPDDoc.OleFunction("OpenAVDoc", "C:\\essaipdf.pdf");
    // rendre acrobat invisible
    // vAcrobatApp.OleFunction("Hide");
    // PDDocument =  vAcrobatPDDoc.OleFunction("GetActiveDoc");  //  GetPDDoc
    // int NumPages = (vAcrobatPDDoc.OleFunction("GetNumPages") - 1);
     long retVal = vAcrobatPDDoc.OleFunction("PrintPagesSilent",
     0,        // First page
    -1, // Last page (-1 is all pages)
     1,        // Postscript level
     0,        // Binary ok
     1         // Shrink to fit
     );
    // if (retVal != 0)
    // AfxMessageBox(_T("The Print was a success"));
     // iNumPages = PDDoc.GetNumPages
    //AVDoc.printPagesSilent 0, iNumPages - 1, 2, True, true
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm1::Button2Click(TObject *Sender)
    {
     vAcrobatPDDoc.OleFunction("Close");
     vAcrobatApp.OleFunction("CloseAllDocs");
     vAcrobatApp.OleFunction("Exit");
     vAcrobatPDDoc = Unassigned;
     vAcrobatApp = Unassigned;
    }
    //---------------------------------------------------------------------------
    et deux liens interressants
    --
    Plutot que d'essayer de réinventer la roue, apprenons à nous en servir

  3. #3
    Rédacteur
    Avatar de blondelle
    Homme Profil pro
    Inscrit en
    Mars 2006
    Messages
    2 738
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 2 738
    Points : 3 766
    Points
    3 766
    Par défaut
    Un bout de code Delphie trouve sur le site que j'ai converti, le texte est insere dans un TMemo
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
     
    //---------------------------------------------------------------------------
    #include <vcl.h>
    #pragma hdrstop
    #include "Unit1.h"
    #include <utilcls.h>
    //---------------------------------------------------------------------------
    #pragma package(smart_init)
    #pragma resource "*.dfm"
    TForm1 *Form1;
    Variant vAcrobatApp, vAcrobatPDDoc;
    //---------------------------------------------------------------------------
    __fastcall TForm1::TForm1(TComponent* Owner)
            : TForm(Owner)
    {
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm1::Button1Click(TObject *Sender)
    {
    // executer l'application
     vAcrobatApp = CreateOleObject("AcroExch.App");
    // executer le document
    // vAcrobatPDDoc = CreateOleObject("AcroExch.PDDoc");
     vAcrobatPDDoc = CreateOleObject("AcroExch.AVDoc");
    // ouvrir acrobat vide
     vAcrobatApp.OleFunction("Show");
    // deux facon d'ouvrir un fichier
     vAcrobatPDDoc.OleFunction("Open", "D:\\ADO_DOC\\09.pdf", true);   // C:\\essaipdf.pdf", true);
    // vAcrobatPDDoc.OleFunction("OpenAVDoc", "C:\\essaipdf.pdf");
    // rendre acrobat invisible
    // vAcrobatApp.OleFunction("Hide");
    if(vAcrobatPDDoc.OleFunction("IsValid"))
    {
    vAcrobatApp.OleFunction("MenuItemExecute", "Edit"); //select all and copy to clipboard
    vAcrobatApp.OleFunction("MenuItemExecute", "SelectAll");
    vAcrobatApp.OleFunction("MenuItemExecute", "Edit");
    vAcrobatApp.OleFunction("MenuItemExecute", "Copy");
    Memo1->PasteFromClipboard();
    Memo1->Lines->SaveToFile("c:\\essai_pdf.doc");
    }
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm1::Button2Click(TObject *Sender)
    {
    // vAcrobatPDDoc.OleFunction("Close");
     vAcrobatApp.OleFunction("CloseAllDocs");
     vAcrobatApp.OleFunction("Exit");
     vAcrobatPDDoc = Unassigned;
     vAcrobatApp = Unassigned;
    }
    //---------------------------------------------------------------------------
    --
    Plutot que d'essayer de réinventer la roue, apprenons à nous en servir

  4. #4
    Rédacteur
    Avatar de blondelle
    Homme Profil pro
    Inscrit en
    Mars 2006
    Messages
    2 738
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Mars 2006
    Messages : 2 738
    Points : 3 766
    Points
    3 766
    Par défaut
    L'emploie d'un TRichEdit donne un meilleur resultat sur le texte mais le graphique et les images sont ignorees
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    RichEdit1->PasteFromClipboard();
    RichEdit1->Lines->SaveToFile("C:\\essai_pdf.doc");
    --
    Plutot que d'essayer de réinventer la roue, apprenons à nous en servir

  5. #5
    Membre actif
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    385
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2006
    Messages : 385
    Points : 288
    Points
    288
    Par défaut
    merci Blondelle,
    je vais voir ces liens
    « Aucun homme ne peut rien vous révéler sinon ce qui repose déjà à demi endormi dans l'aube de votre connaissance»

    « No man can reveal to you aught but that which already lies half asleep in the dawning of your knowledge »_(¯`·.__-Alg3ri4nH4ck3r-__.·´¯)_

Discussions similaires

  1. afficher un fichier rtf dans une rich text box
    Par r83 dans le forum Windows Forms
    Réponses: 3
    Dernier message: 17/03/2009, 14h48
  2. [VB.Net] afficher un fichier pdf dans une page WEB
    Par kasaw dans le forum ASP.NET
    Réponses: 3
    Dernier message: 25/08/2008, 16h02
  3. Comment afficher un fichier texte dans une TextBox multiligne ?
    Par rudylar dans le forum Windows Forms
    Réponses: 7
    Dernier message: 02/06/2008, 17h29
  4. afficher les fichiers locaux dans une webapp
    Par gabardine dans le forum Flex
    Réponses: 0
    Dernier message: 21/05/2008, 16h02
  5. afficher un fichier ppt dans une page web
    Par aymenroma dans le forum Balisage (X)HTML et validation W3C
    Réponses: 6
    Dernier message: 31/07/2006, 19h29

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo