Results 1 to 3 of 3

Thread: printing PDF files

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,168

    printing PDF files

    I'm referencing "Adobe Acrobat 7.0 Browser Control Type Libary 1.0" and I have the following code:

    Code:
    private void button1_Click(object sender, System.EventArgs e)
    		{
    			AcroPDFLib.AcroPDFClass pdf;
    			pdf = new AcroPDFLib.AcroPDFClass();
    			pdf.src = @"C:\sample.pdf";
    			pdf.Print();//i tried pdf.PrintAll() and pdf.PrintPages() - both didn't work
    		}
    Any idea why this isn't working? I'm using Acrobat 7.0 by the way. Also, when I use pdf.LoadFiles() instead of pdf.src, i get an error message saying "object not initialized", and this was with the "new AcroPDFLib.AcroPDFClass()" line included.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: printing PDF files

    It works using the ActiveX control so maybe the AcroPDFClass class isn't meant to be used on its own. Strange that it's available if it's not but I can't really see a way to check that the specified file was actually loaded. I tried LoadFile in a VB app and it threw an exception regarding trying to write protected memory. Not good at all.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    New Member
    Join Date
    Nov 2007
    Posts
    1

    Re: printing PDF files

    THE PROBLEM IS...

    that we aren't supposed to use the COM like that (as the previous poster has mentioned).

    After 5 hours of nutting this out, I finally understood what some posters meant (in other forums).

    In simple terms:
    - DO NOT use the 'Add reference' menu to add the .dll file
    - Instead, right click on the toolbar where you design your forms, and choose to add more tools (customize or something like add more)
    - Choose the Adobe Reader ActiveX tool

    now in your references window you should see the elusive AxAdobePDF component.

    What I do is to just place a PDF viewer onto my form, and make it invisible.


    Cheers,
    Wilson

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width