Print PDF from http URL

I have a project wherein a piece of it will require me to retrieve a PDF file from a http URL (i.e.
http://www.somewebsite.com/test.pdf) and print the PDF.  I've been looking for examples of how to do this but I'm not finding any. Is the only way to do this download the PDF to disk and then send to a
printer? Speaking of printing, I need to send the PDF to an IP address which I've not done before either. If someone could point me to a good example of that, I'd appreciate it.
Thank you.

Since I had access to ABCPDF8, I ended up using it to print the PDF.  ABCPDF comes with example projects that helped me figure out what I needed to get the PDF to print.  For anyone who also has access to
ABCPDF and needs to use it to print a PDF, I've pasted my code below.  The code is a cut-down version of the ABCPDF example as I did not need a lot of the functionality the example had. 
Thanks again to all who responded to my post.
ABCPDF8 code:
            private static WebSupergoo.ABCpdf8.Doc mDoc = null;
            private static System.Drawing.Printing.PrintDocument mPrint = null;
            private static int mPage = 0;
            private static int mPageSaved = 0;
            private static int mCopiesNumber;
            private static string pdfFile;
            private static string pdfPrinterName;
            private static string pdfPrinterTray;
            public enum Method
                AdobeReader,
                ABCPDF8
            /// <summary>
            /// </summary>
            /// <param name="pdfFilePath"></param>
            /// <param name="printerName"></param>
            /// <param name="printMethod"></param>
            public static void DoPrint(string pdfFilePath, string printerName, string printerTray, Method printMethod)
                if (System.IO.Path.GetExtension(pdfFilePath).Trim().ToUpper() != ".PDF")
                    throw new System.ApplicationException(String.Format("File '{0}' is not a PDF!", pdfFilePath));
                pdfFile = pdfFilePath;
                pdfPrinterName = printerName;
                pdfPrinterTray = printerTray;
                switch (printMethod)
                    case Method.AdobeReader:
                        PrintViaAdobeReader();
                        break;
                    case Method.ABCPDF8:
                        PrintViaABCPDF8();
                        break;
                    default:
                        break;
           private static void PrintViaABCPDF8()
                mDoc = new WebSupergoo.ABCpdf8.Doc();
                //read in the PDF
                mDoc.Read(pdfFile);
                //crete new print document
                mPrint = new System.Drawing.Printing.PrintDocument();
                mPrint.DocumentName = System.IO.Path.GetFileName(pdfFile);
                mPrint.PrinterSettings.PrinterName = pdfPrinterName;
                mPrint.PrinterSettings.FromPage = 1;
                mPrint.PrinterSettings.ToPage = mDoc.PageCount;
                mPrint.PrinterSettings.MinimumPage = 1;
                mPrint.PrinterSettings.MaximumPage = mDoc.PageCount;
                mPrint.QueryPageSettings += (sndr, args) =>
                    if (!String.IsNullOrWhiteSpace(pdfPrinterTray))
                        for (int i = 0; i < mPrint.PrinterSettings.PaperSources.Count; i++)
                            if (mPrint.PrinterSettings.PaperSources[i].SourceName.ToLower().Trim() == pdfPrinterTray.ToLower())
                                args.PageSettings.PaperSource = mPrint.PrinterSettings.PaperSources[i];
                                break;
                mPrint.BeginPrint += new System.Drawing.Printing.PrintEventHandler(DoBeginPrint);
                mPrint.EndPrint += new System.Drawing.Printing.PrintEventHandler(DoEndPrint);
                mPrint.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(DoPrintPage);
                mPrint.Print();
                mDoc.Clear();
                mDoc.Dispose();
            /// <summary>
            /// Start printing via ABCPDF8
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            private static void DoBeginPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
                mPage = mPrint.PrinterSettings.FromPage;
                mPageSaved = mDoc.PageNumber;
                mCopiesNumber = 1;
            /// <summary>
            /// Print page using ABCPDF8
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            private static void DoPrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
                mDoc.PageNumber = mPage;
                if (mCopiesNumber++ >= mPrint.PrinterSettings.Copies)
                    mPage++;
                    mCopiesNumber = 1;
                e.HasMorePages = mPage <= mPrint.PrinterSettings.ToPage;
                using (System.Drawing.Graphics g = e.Graphics)
                    if (mDoc.PageCount == 0) return;
                    if (mDoc.Page == 0) return;
                    WebSupergoo.ABCpdf8.XRect cropBox = mDoc.CropBox;
                    double srcWidth = (cropBox.Width / 72) * 100;
                    double srcHeight = (cropBox.Height / 72) * 100;
                    double pageWidth = e.PageBounds.Width;
                    double pageHeight = e.PageBounds.Height;
                    double marginX = e.PageSettings.HardMarginX;
                    double marginY = e.PageSettings.HardMarginY;
                    double dstWidth = pageWidth - (marginX * 2);
                    double dstHeight = pageHeight - (marginY * 2);
                    const bool autoRotate = true;
                    int rotate = 0;
                    if (autoRotate && srcWidth != srcHeight && dstWidth != dstHeight
                        && (srcWidth > srcHeight) != (dstWidth > dstHeight))
                        double temp = pageWidth;
                        pageWidth = pageHeight;
                        pageHeight = temp;
                        temp = marginX;
                        marginX = marginY;
                        marginY = temp;
                        temp = dstWidth;
                        dstWidth = dstHeight;
                        dstHeight = temp;
                        rotate = GetPageRotation(mDoc) % 360;
                        if (rotate <= -180)
                            rotate += 360;
                        else if (rotate > 180)
                            rotate -= 360;
                        rotate = rotate > 0 ? 90 : -90; // default to -90
                        // Use -90 because we want the staple to be at a top corner
                        // of the page.  Assuming a rotation of "rotate" (0 or 180 degrees)
                        // produces upright contents, a rotation of -90 or 90 degrees
                        // (respectively) produces outputs whose top is at the
                        // left edge of the portrait page.  The staple at the top-left
                        // corner of the portrait page will be at the top-right corner of the
                        // contents.
                    else
                        rotate = GetPageRotation(mDoc) % 360;
                        if (rotate != 180 && rotate != -180)
                            rotate = 0;
                    // if source bigger than destination then scale
                    if ((srcWidth > dstWidth) || (srcHeight > dstHeight))
                        double sx = dstWidth / srcWidth;
                        double sy = dstHeight / srcHeight;
                        double s = Math.Min(sx, sy);
                        srcWidth *= s;
                        srcHeight *= s;
                    // now center
                    double x = (pageWidth - srcWidth) / 2;
                    double y = (pageHeight - srcHeight) / 2;
                    // save state
                    double saveDotsPerInch = mDoc.Rendering.DotsPerInch;
                    mDoc.Rendering.AutoRotate = false;
                    System.Drawing.RectangleF theRect = new System.Drawing.RectangleF((float)x, (float)y, (float)srcWidth, (float)srcHeight);
                    int theRez = e.PageSettings.PrinterResolution.X;
                    if (e.PageSettings.Color) // color is generally CMYK so to translate from dpi to ppi we divide by four
                        theRez /= 4;
                    if (theRez <= 0) // Invalid printer resolution - use the default value
                        theRez = 72;
                    // draw content
                    mDoc.Rect.SetRect(cropBox);
                    System.Drawing.Drawing2D.Matrix oldTransform = null;
                    if (rotate != 0)
                        oldTransform = g.Transform;
                        switch (rotate)
                            case 90:
                                using (System.Drawing.Drawing2D.Matrix matrix = new System.Drawing.Drawing2D.Matrix(0,
1, -1, 0,
                                    (float)(2 * y + srcHeight), 0))
                                    g.MultiplyTransform(matrix);
                                break;
                            case -90:
                                using (System.Drawing.Drawing2D.Matrix matrix = new System.Drawing.Drawing2D.Matrix(0,
-1, 1, 0,
                                    0, (float)(2 * x + srcWidth)))
                                    g.MultiplyTransform(matrix);
                                break;
                            case 180:
                            case -180:
                                using (System.Drawing.Drawing2D.Matrix matrix = new System.Drawing.Drawing2D.Matrix(-1,
0, 0, -1,
                                    (float)(2 * x + srcWidth), (float)(2 * y +
srcHeight)))
                                    g.MultiplyTransform(matrix);
                                break;
                    g.SetClip(theRect);
                    if (!mDoc.Encryption.CanPrintHi)
                        mDoc.Rendering.DotsPerInch = 72;
                        using (System.Drawing.Bitmap bm = mDoc.Rendering.GetBitmap())
                            g.DrawImage(bm, theRect);
                    else
                        mDoc.Rendering.DotsPerInch = theRez;
                        mDoc.Rendering.ColorSpace = WebSupergoo.ABCpdf8.XRendering.ColorSpaceType.Rgb;
                        mDoc.Rendering.BitsPerChannel = 8;
                        byte[] theData = mDoc.Rendering.GetData(".emf");
                        System.IO.MemoryStream theStream = new System.IO.MemoryStream(theData);
                        using (System.Drawing.Imaging.Metafile theEMF = new System.Drawing.Imaging.Metafile(theStream))
                            g.DrawImage(theEMF, theRect);
                    if (oldTransform != null)
                        g.Transform = oldTransform;
                        oldTransform.Dispose();
                    // restore state
                    mDoc.Rendering.DotsPerInch = saveDotsPerInch;
                    mDoc.Rendering.AutoRotate = true;
            /// <summary>
            /// End printing ABCPDF8
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            private static void DoEndPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
                mDoc.PageNumber = mPageSaved;
            /// <summary>
            /// Current page number
            /// </summary>
            public static int PageNumber
                get
                    if (mDoc == null)
                        return 0;
                    else
                        return mDoc.PageNumber;
                set
                    if (mDoc != null && value <= mDoc.PageCount && value != mDoc.PageNumber)
                        mDoc.PageNumber = value;
            /// <summary>
            /// </summary>
            /// <param name="theDoc"></param>
            /// <returns></returns>
            private static int GetPageRotation(WebSupergoo.ABCpdf8.Doc theDoc)
                return (theDoc != null) ? theDoc.GetInfoInt(theDoc.Page, "Rotate") : 0;

Similar Messages

  • Print pdf from ValueLine

    Ver 11 says plug-in doesn't work; Ver 10 worked fine
    Further information:  tried to print pdf from this site; error message says can't do plug-in.   Just downloaded fresh Ver. 11 today and accepted conditions.  Help, please!

    I'm using Win.7.1, trying to download Acrobat Reader 11, reaching it from 
    AOL 9.7 .  I can't download online pdfs from multiple on-line resources 
    (e.g., ValueLine and your own Adobe site).  After I've de-installed the  Reader
    11 and started fresh, here's what I see:  The installation file  appears in
    my AOL download file.  My Norton Internet Security says its  safe, and I
    double click on it.  (I never get to the warning dialog -  presumably because
    Norton has already vetted the install file.) When I go back  to the download
    file, open it and click on Finish, the installation file  disappears.  I
    never get to step 3 of the installation.  I don't have  a functioning Reader
    XI, either.
    In a message dated 1/8/2014 9:03:43 P.M. Eastern Standard Time, 
    [email protected] writes:
    Re:  print pdf from ValueLine
    created  by Pat Willener (http://forums.adobe.com/people/pwillener)  in 
    Adobe Reader - View the full  discussion
    (http://forums.adobe.com/message/5994918#5994918)

  • I have installed Lion and have problems to print PDF from prewiev.

    I have installed Lion and have problems to print PDF from prewiev. When trying to print Prewiev locks. Anyone out there with the same problem?

    Hello David and Nicole
    I just installed Lion on my iMac, which was purchased in 2007, and I cannot print from Preview; it keeps locking up and not responding. So, I have to force quit Preview. I have been sending error reports to Apple. I suggest everyone who has this problem, send error reports!
    I can print from other applications, like Pages, with my Canon Laserjet. I do not think it is a printer issue becasue I can print in other application.
    I took your advice and installed Adobe reader. Now I can print pdf's.
    Thanks
    Ed

  • HELP! Why can't I print PDFs from my applications?

    For over a year I've used Adobe Pro to "print" PDFs from AutoCAD LT (a drafting program). This allows me to perform design/drafting services for long distance clients and email them PDF "prints" of drawings for them to review, print, and use. It has worked beautifully...until this week. Now whenever I go to print a PDF from AutoCAD (or even other Windows applicacations like Word) it gives me an error telling me to change the Advanced printer preferences to "print directly to printer". When I go into the Adobe printer preferences and select this option. and return to print the PDF, selecting the print command causes AutoCAD to hang indefinitely and eventually crash when I try to cancel the print command. This behavor is the same inside other Windows applications like Word. So I've concluded that the issue is inside Adobe or my computer's Adobe "printer" settings. I've spent 5-6 hours unistalling a reinstalling Adobe several times in hopes to get back to whatever settings that worked before...to no success.
    The last piece to the puzzles is that I was on vacation last week. Instead of the desktop computer in my office that I typically use, I took my old laptop. I only have one license of Adobe Pro. Even though I hadn't used it for months on the laptop, it worked fine creating PDFs from AutoCAD. My question is: did using Adobe on my laptop deactivate the Adobe loaded on my desktop? And if so, why hasn't deactivating and uninstalling the Adobe Pro on my laptop, and unistalling/reinstalling/activating the Adobe Pro on my desktop, fixed the problem?
    I'm at my wits' end...any feedback/advice would be much appreciated!

    In WORD (Sorry I don't have Autocad), can you go to the FILE>Print and print to the Adobe PDF printer with no problem? If not, can you select print-to-file and then open the file in Distiller to complete the conversion? If the latter works, it sounds like you may have disabled AcroTray, a necessary part of the printing process.

  • Print PDF from Forms

    Hi
    I wonder if anyone can help. We're running Forms 10.1.2.30 against an Oracle 10.1.0.5.0 database using IE8 on Windows XP and Windows 7 clients.
    We generate utility bills using Oracle Reports. These work fine at the moment as we print these reports directly to the printer from Reports. However, we now need to perform some post processing to the bills so I would like to produce the bill to a PDF, perform some post processing and then send the PDFs to the printer on batch.
    Does anyone have any tips on how to send the PDFs to a printer on batch? I can host it out to Acrobat using the undocumented/unsupported /t option, but I would rather not rely on third party software (especially undocumented/unsupported features).
    I've found a link to the Oracle Forms PJC/BEAN - PDF Project, but I cannot download the file. Something to do with the download site been seized by the FBI!
    https://sites.google.com/site/jvrpdfproject/version-1-5-2-english
    Thanks in advance.
    Neil

    Hi.
    What mechanism do you use now to send a PDF to printer? Do you have each printer defined on middleware (application server) or you download pdf from application server an print it localy?
    Best Regards
    Gregor

  • How can I lauch a PDF from a URL from within my Plug-In?

    I have my plug-in working pretty good with the exception that I can not figure out how to launch a PDF using a URL. I am able to launch a PDF file from the file path, just not a URL.
    Any assistance is appreciated.
    Gregory

    Leonard,
    Yes, I want to open a PDF that lives on a web server. I will know the URL to the doc I want to open and I want to open it via a SDK call from within my plug-in. I can open docs from the file system using the following:
    AVDocOpenFromFile(compareASFilePath, asFileSys, NULL);
    Is there a SDK call that will allow me to open the doc using a URL like 'http://216.24.154.161/files/XXX.pdf' ?
    Thanks,
    Gregory

  • Bad format,when printing pdf from ipad

    Hi got a Iprint appliance 101 with 2 sharp MX printers
    I've "Air" enabled them , and they show in Ipads and macs , But when tying to print to them , when examining print jobs in a mac , "printing --Bad format" shows
    the File is a PDF
    Any Idea what to look at ??
    Lars

    Not sure if this will help, but I would try the latest 7.x version from http://www.adobe.com/support/downloads/detail.jsp?ftpID=3953

  • Print PDF from link... possible?

    Is it possible to print a PDF file when you click a link. I
    don't want
    to open the PDF first and print it from there?
    Is it possible?
    Kim
    http://www.geekministry.com

    You might check the Dreamweaver Developer Page -
    http://www.adobe.com/devnet/
    But... I really doubt it is possible to send something
    directly to a printer without opening the program that is able to
    READ the file and send the proper formatting to the printer... and
    that means opening the file
    Added... the little I know about printing
    Any file, by itself, is just so much "garbage data" if you
    WERE able to drag and drop it on a printer icon
    Each file type consists of a unique arrangement of bits and
    bytes
    The file is both displayed on a computer screen and
    intepreted for printing by the program that reads the file
    When printing, a data stream is sent by that program to the
    printer's software... which converts that data stream into commands
    to the printer about where to print a pixel (may be wrong term) and
    how many close together (such as letters) or "scattered" such as a
    gray background
    I just don't think it is possible to send a document directly
    to a printer, without the software that reads the type of file
    being open to format the data and interface with the printer
    driver

  • Print PDFs from Website Without Header

    Is there a way to print PDFs in safari from websites where it does not inclue the header and footer informaition with the website URL, time etc?

    In Safari when you hint "Print" it opens up the print dialog. On the bottom you have the point "Print headers and footers." If you don't see the extended print options click on the arrow in the upper right corner.

  • Help from generate pdf from http pdf document

    hi,
    I've somes url like :
    http://www.server01/mydoc1.pdf,
    http://www.server01/mydoc2.pdf
    from another server (server02),what is the solution to merge
    a new pdf document on server02 from theses urls from server01?
    I try with cfdocument but it doesn't work...
    thanx for your help
    regards,
    Pascal

    I try with cfdocument but it doesn't work...
    I don't expect it to. Cfdocument is for converting from CFML
    and HTML to PDF, not for merging.
    Since you're on CF8, you can use the cfpdf tag. The following
    example downloads two PDF files, then merges them. However, I get
    the feeling there should be a more efficient way.

  • How do i add a video in a PDF from an URL

    My dilemma: Creating an Interactive PDF using java and I would like to add various streaming video's throughout the pdf from url.  I would like them to run within the pdf.  I would like people to be able to play them, and then play them again if they need to listen again, aka, loop, I guess.
    My attempts: I have added the video from url using adobe acrobat pro editor and video is playing as i needed but i would like to do it from java sourc. i can do it from adobe acrobat pro editor and working fine .
    Could anyone please help or explain me how do adobe do that and how do adobe handle this from backend or how can i do that from java.This is urgent .

    Adobe doesn't provide support for third-party Java libraries, nor can you control Acrobat from an external Java program; if yours can't do what you need then you will have to add the classes yourself. The ISO 32000 standard for PDF explains what's required to define a Rich Media Annotation; it's not a lot different from a regular annot at the top level, and inside you have COS streams for the embedded player widget (a SWF file) and local media (or a URI pointing to some remote media), plus tags to define how the playback works. People have ported these features to LaTeX and PHP, it's time-consuming but not hard if you know how to code.
    Note there is no 'loop' setting for an RMA, you would have to implement that yourself with a custom player widget.

  • Printing PDF from IE9 doesn't honor printer settings

    I am trying to print a PDF from IE 9 and have it honor my printer settings (which are to store to my mailbox on our Canon iR3035 rather than print out).  It used to work fine.  I found the following bug listed in the release notes for Adobe Reader 10.1 however it clearly says the fix is to update IE which clearly isn't fixing the problem.  If I disable protected mode then it works but that isn't what we should have to do for this to work.
    Windows 7 Pro 32 and 64 bit
    Adobe PDF Reader 10.1.1.33 and 10.1.2.45
    Internet Explorer 8 and 9
    "Internet Explorer: With Internet Explorer running in protected mode, the user's printer settings are not honored, and the manufacturer's or deployer's defaults are used. This behavior occurs for IE7/IE8 with Acrobat/Reader 9.x or IE7 with Acrobat/Reader 10.x. The workaround is to disable Internet Explorer protected mode, or upgrade to IE8. [2874948]"
    Anyone know of another workaround other than turning protected mode off??
    Thanks!
    Jake

    Hi Sonal,
    Thank you for continuing to try to track this down.  The snapshot you show is exactly what we want the behavior to be however it's not what is happening on our systems here.  I'm not sure what else I can provide to try to help reproduce the problem however it is the same on multiple systems.  Here is some more info (I apologize in advance for the number of snapshots but I hope they will lend useful info!).  Please let me know what else I can provide that would help!  These snapshots are from my system which is 64-bit (32-bit systems exhibit the same symptoms).
    Adobe Reader is version 10.1.3:
    Adobe PDF Reader add-on in IE is 10.1.3.23:
    IE is version 9.0.8112.16421 update version 9.0.6 (KB2675157):
    IE Security settings tab:
    Printer Driver version - Go to Control Panel, Devices and Printers, Print Server Properties, Drivers tab, Choose Canon iR3035/iR3045 PCL6 and click properties, Click on Driver File and click properties, Detail tab:
    Printer Preferences:
    Printing the samplepdf.com homepage in IE9:
    Printing the samplepdf.com pdf file in IE9:
    Hope these help. Thanks for your time!
    Jake

  • Cannot print pdf from Excel. Saving as log file

    I am trying to print an Excel page to pdf and everytime I get an error.
    I am using Adobe Acrobat 9 and Excel 2010

    You printed to Adobe PDF from excel.
    There was an error which prevented the pdf from being created.
    That log file lists the errors and seeing it's content might enable us to determine why the job failed.
    Open the log file with Notepad or any text editor (Word)
    Copy that text to this forum

  • Problem printing PDF from BPM Studio ?

    I'm using JasperReports to try to print a PDF from BPM Studio 10.3.2
    I have tried many ways but always get the same problem:
    Caused by: com.lowagie.text.pdf.PdfWriter.setRgbTransparencyBlending(Z)V
    Caused by: java.lang.NoSuchMethodError: com.lowagie.text.pdf.PdfWriter.setRgbTransparencyBlending(Z)V
    I added all the needed jars as external resources and catalog them as Java components.
    Anyone dealed with this issue before?
    Thanks in advance!
    /Patricio
    ps: sorry for my english, but isn't my native language.

    Actually, Word 2013 supports opening of PDF files and creating Word documents from same. The problem is that for anything other than very simple PDF files, the conversion is wonky at best!
    The popup mentioned by “bannerman” is definitely not an Adobe Reader message, but possibly an annotation of something generated by JavaScript.
              - Dov

  • Printing PDF from IE with Adobe Reader - extra white space at top of page

    I searched the forums far and wide but did not find this question or information to answer it.  If it's out there, I'd be much obliged if you'd point me in the right direction.
    A user of the web app for which I do tech support just called to say that starting today, whenever he opened a PDF from our app (in IE), the PDF looks fine on screen but when he prints the PDF, every page has extra blank/white space inserted at the top, which cuts off the bottom inch or two of each page.
    No other users have called with this complaint, and if changes to our app or an automatic background Adobe Reader or IE update caused this problem, I would have heard from many users.  I have a sneaking suspicion I have heard about this from other users, but since troubleshooting their IE or Adobe isn't exactly my job, I don't know if I did any more than advise them to talk to their tech support people. 
    I can't recreate his problem (read: it works fine for me), but I'd like to help him.  Can anyone think of a reason why this might be happening?
    Thanks in advance.

    What I know:  He's using Adobe Reader X.  I do not know if it's the most recent version.  The problem only exists with PDFs from our web app; he's not having trouble with other sites or with other PDFs.
    I do not have a copy of the PDF; I can't give you the copy I downloaded when I logged into his account because there is proprietary confidential information on it, but everything worked fine for me and he's the only user with this complaint, so I believe it's related to his PC or printer, not to our app or to Adobe per se. 
    I sent him email asking for more information, but I do not know what printer he's using.  I don't even know what version of Windows he's running. 
    Based on some info from Adobe, I suggested he make sure he's using the most recent version (10.1.2), try 'print as image" to see if that's any more successful, and make sure his printer drivers are up to date. 
    Given the nature of tech support, if he solves the problem or finds a workaround he's happy with, I may never hear from him again to know.  I just wanted to know if this was a known issue and what recommended resolutions for it might be.  Having not found anything on the web at large, I figured the Adobe forums would be a good place to ask.
    Thanks for the time you took to answer.

Maybe you are looking for