Receive PDF from WebService and Download it

Hello, 
I'm trying to integrate Europass Webservice with the website that I'm currently developing.
This WebService allows you to, through a XML or JSON file, obtain either a PDF or a Word CV.
They Provide the information to communicate with their WS and a Sample XML (here), but you can do your own, since you respect their schema.
To ensure that the xml is okay use the remote upload service and see the resulting CV from your XML in their website.
So my problem is that I can comunicate with the Web service and I also Get a OK Response (Great!), However when downloading the PDF it is all blank.
What am I Missing here?Can you guys please guide me?
To reproduce this, copy the code below and add the content of this http://goo.gl/XyM7Ma to the file in the xmlcontent path.
Thanks in Advance,
Nelssen
CODE:
            //POST
            string xmlContent = File.ReadAllText("D:\\XML\\CV.xml");
            string URL = "https://europass.cedefop.europa.eu/rest/v1/document/to/pdf-cv";
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
            request.Method = "POST";
            request.ContentType = "application/xml";
            using (Stream webStream = request.GetRequestStream())
            using (StreamWriter requestWriter = new StreamWriter(webStream, System.Text.Encoding.UTF8))
                requestWriter.Write(xmlContent);
            //RESPONSE
            try
                WebResponse webResponse = request.GetResponse();
                using (Stream webStream = webResponse.GetResponseStream())
                    if (webStream != null)
                        using (StreamReader responseReader = new StreamReader(webStream))
                            string response = responseReader.ReadToEnd();
                            byte[] byteResponse = Encoding.UTF8.GetBytes (response);
                            Response.Clear();
                            Response.Buffer = true;
                            Response.ContentType = "application/pdf";
                            Response.AddHeader("content-disposition", "attachment;filename=test.pdf"); // Save file         
                            Response.AddHeader("Content-Length", byteResponse.Length.ToString());
                            Response.Charset = "";
                            Response.Cache.SetCacheability(HttpCacheability.NoCache);
                            Response.BinaryWrite(byteResponse);
                            Response.End();

StreamReader is a textual reader.  If you are receiving a binary file from the URL then you should be using a
BinaryReader.
Michael Taylor
http://blogs.msmvps.com/p3net

Similar Messages

  • I'm attempting to create a pdf from InDesign and the Illustrator image does not appear properly.

    I'm attempting to create a pdf from InDesign and the Illustrator logo does not appear properly. The logo has a light blue color background with a black to white gradiant over it with a multiply designation set at 100%.  I flattened the logo in illustrator before importing into InDesign. When the pdf is created, the blue background of the logo drops out and the only thing showing is the graduated screen of black. PLEASE HELP!!!!!!

    Thanks for your reply Peter,
    I'm on Mac OSX (10.5.8) using Acrobat 7 Professional and Acrobat 
    Reader 9 to view the pdf. I created it by exporting. Attached is a 
    screen capture of the letterhead. Since I posted, I sent a test pdf to 
    my partner's computer eventhough it didn't look right on my system and 
    she said it looked fine to her. I've restarted my computer and tried 
    again and still get the same results.
    Thanks for your help,
    Pat Boullion
    Boullion Graphics
    281 444-5749
    Fax: 281 444-6507
    CONFIDENTIALITY NOTICE
    The information in this email may be confidential and/or privileged. 
    This email is intended to be reviewed by only the individual or 
    organization named above.
    If you are not the intended recipient or an authorized representative 
    of the intended recipient, you are hereby notified that any review, 
    dissemination or copying of this email and its attachments, if any, or 
    the information contained herein is prohibited. If you have received 
    this email in error, please immediately notify the sender by return 
    email and delete this email from your system.

  • Combining PDFs from MACs and PCs

    Is there a way to effortless combine fairly large pdfs created on MACs and on PCs (usually containing images and tables)? We have had terrible problems with this, including image  and caption distortion, etc. Sometimes, we are unable to create pdfs on a PC if we are sent a Word document created on a MAC.
    Any advise could be greatly appreciated.
    Thanks.
    Steve

    If I print to PDF, nothing at all happens.
    If I try to do a Save As, I get the following message:
    “The export failed. The document could not be prepared for exporting.”
    If I right click on the file name and use Convert to Adobe PDF, it will start the process and then stop and return to the Word document.
    Re: Combining PDFs from MACs and PCs
    created by Test Screen Name <http://forums.adobe.com/people/TestScreenName>  in Creating, Editing & Exporting PDFs - View the full discussion <http://forums.adobe.com/message/4710976#4710976

  • Can I take a PDF from iBooks and make it a numbers document?

    Can I take a PDF from iBooks and make it a numbers document?

    To do this on your phone, copy and paste them into your document (tap and hold on the photo to copy it).  If you need to import it to your computer to do this, save it to the camera roll by tapping Edit, tap the photos you want to import, tap Share, tap Save to Camera Roll.  You can then import them to your computer using your usb cable (see http://support.apple.com/kb/HT4083).  Alternatively, attach them 3-4 at a time emails and send them to yourself.

  • I just purchased adobe Acrobat XI Standard Win [Download], from amazon and downloaded it.

    I just purchased adobe Acrobat XI Standard Win [Download], from amazon and downloaded it. When I try to register it I am told I have an incorrect serial number.....it was provided by amazon.....??????

    Hi Larry,
    I apologize for the inconvenience. I will look into this for you!
    Regards, Stacy

  • Album uploaded to Itunes match, plays on computer but won't play on ipod, no cloud symbol next to songs. Press play on 1 track and it skips through the album without playing. I've tried deleting the album from PC and downloading again from match and even

    Album uploaded to Itunes match, plays on computer but won't play on ipod, no cloud symbol next to songs. Press play on 1 track and it skips through the album without playing. I've tried deleting the album from PC and downloading again from match and even after syncing the album won't play on the ipod
    iPod touch, iOS 6.1

    I've just connected the ipod to my computer and checked the music on the iPod. The album that I am having trouble with shows an exclamation symbol next to it. I've tried deleting the album from iTunes and re downloading it then syncing but it doesn't appear to affect the information shown the iPod. The album neither deletes nor updates.

  • Protect PDF from add and delete with rights to add comments

    Hi,
    Can anybody help me to protect my PDF (created Using Acrobat 7) without any rights to add or delete text, but I or others should have the rights to add sticky comments.
    Thanks,
    KDLS

    Hi,
    Thanks for your intention to give solution.
    I got a solution, now I can add comments with protecting the PDF from adding and deleting the text.
    Thanks,
    KDLS

  • Error message when creating PDF from Indesign and Photoshop

    Hi, I reinstalled my Adobe CS2 product, and now get an error message each time I create a PDF from either InDesign or Photoshop. The message reads:
    The instruction at "0x0045c9e5" referenced memory at "0x0215ebdc". The memory could not be "read".
    I appreciate any help in resolving this issue.
    Thanks --Alex

    How do you create the PDF? There are multiple ways and it might make a difference.

  • Can't generate PDF from xdp and XML

    Hello,
    I'm new to livecycle and flashbuilder.
    I assigned as a task to send to a  livecycle server a xdp template and a XML file with the data in order to create the pdf.
    So far, I created a class with two methods that returns as a BLOB the strings of a xdp template and the XML data to populate the template.
    On the main application I'm calling the generatePDFOutput method from the OutputService and as far as I know I'm supposed to get a Blob which I can manipulate to save it as a PDF.
    What could be my error? or how should I approach this problem? I came here since I can't find some document that shows how to create pdf from a flex app using livecycle...
    I appreaciate your help.
    I attach below the code of the main class
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="initializeChannelSet();">
        <fx:Script>
            <![CDATA[
                import flash.sampler.Sample;
                import mx.messaging.ChannelSet;
                import mx.messaging.channels.AMFChannel;
                import mx.rpc.CallResponder;
                import mx.rpc.events.ResultEvent;
                import services.outputservice.OutputService;
                import valueObjects.BLOB;
                import valueObjects.OutputResult;
                import valueObjects.PDFOutputOptionsSpec;
                import valueObjects.RenderOptionsSpec;
                private var parentResourcePath:String="/";
                private var serverPort:String="192.168.3.46:8080";
                private function initializeChannelSet():void{
                    var cs:ChannelSet= new ChannelSet();
                    cs.addChannel(new AMFChannel("remoting-amf", "http://"+serverPort+"/remoting/messagebroker/amf"));
                    outputService.setCredentials("administrator","password");
                    outputService.channelSet=cs;
                protected function btn_clickHandler(event:MouseEvent):void
                var pdf:OutputService= new OutputService();
                var x:TestPDF= new TestPDF();
                var wsCall:CallResponder= new CallResponder();
                var out:PDFOutputOptionsSpec= new PDFOutputOptionsSpec();
                out.fileURI="D:\PDF_Output\test.pdf";
                var render:RenderOptionsSpec= new RenderOptionsSpec();
                wsCall.token=pdf.generatePDFOutput("PDF","Form.xdp","D:\\PDF_Output",out,render,TestPDF.D ata());
                var res:BLOB= wsCall.lastResult as BLOB;
                var result:ByteArray= new ByteArray();
                    result=res as ByteArray;
                var a:Number=2;
                protected function outputService_resultHandler(event:ResultEvent):void
                    // TODO Auto-generated method stub
            ]]>
        </fx:Script>
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
            <mx:RemoteObject id="outputService" destination="OutputService" result="outputService_resultHandler(event);"/>
        </fx:Declarations>
        <s:Button id="btn" x="90" y="141" label="Button" click="btn_clickHandler(event)"/>
    </s:Application>

    build.xml file for Hibernate:
    <?xml version="1.0"?>
    <project name="Hibernate"
    default="schemaGenerator" basedir="C:\Hibernate">
    <property name="src.dir" value="src"/>
    <property name="classes.dir" value="classes"/>
    <property name="hibernate" value="hibernate-2.1"/>
    <property name="hibernate.mappings" value="mappings"/>
    <property name="jdbc" value="C:\oracle\product\10.1.0\Db_1\jdbc"/>
    <property name="hibernate.extensions" value="tools"/>
    <property name="hibernate.properties" value="properties"/>
    <path id="project.class.path">
    <pathelement location="${classes.dir}" />
    <fileset dir="${hibernate}">
    <include name="hibernate2.jar"/>
    </fileset>
    <fileset dir="${hibernate}/lib">
    <include name="*.jar"/>
    </fileset>
    <fileset dir="${hibernate.extensions}/lib">
    <include name="*.jar"/>
    </fileset>
    <fileset dir="${hibernate.extensions}">
    <include name="hibernate-tools.jar"/>
    </fileset>
    <fileset dir="${jdbc}/lib">
    <include name="classes12.jar"/>
    </fileset>
    </path>
    <target name="init"> <mkdir dir="${src.dir}"/>
    <mkdir dir="${classes.dir}"/>
    </target>
    <taskdef name="javaGen"
    classname="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask"
    classpathref="project.class.path"/>
    <target name="javaGenerator" depends="init">
    <javaGen output="${src.dir}">
    <fileset dir="${hibernate.mappings}">
    <include name="Catalog.hbm.xml"/>
    </fileset>
    </javaGen>
    </target>
    <target name="compile" depends="javaGenerator">
    <javac srcdir="${src.dir}"
    destdir="${classes.dir}">
    <classpath refid="project.class.path"/></javac>
    </target>
    <taskdef name="schemaGen"
    classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask"
    classpathref="project.class.path"/>
    <target name="schemaGenerator" depends="compile">
    <schemaGen properties="${hibernate.properties}/hibernate.properties" quiet="no">
    <fileset
    dir="${hibernate.mappings}">
    <include name="Catalog.hbm.xml"/>
    </fileset>
    </schemaGen>
    </target>
    </project>

  • CS3 Not loading from disc and download link not working

    I had to wipe my MacBook Pro hard drive.  I am now running Mavericks.  I bought CS5 as an upgrade to CS3 so CS3 is required to be on my computer before it will let me load the update.I have tried loading CS3 from the disk (I have my original discs) but it won't let me.  It gets stuck about 2/3rds of the way through install.  I've tried 4 times and I'm fed up. Nothing should be this hard. There is nothing wrong with my CD drive either, as I have loaded four other pieces of software that come on CD.
    I tried to download CS3 from the links that Adobe tells me to use but none of the links work.  I have searched for links in general, I have done specific searches in Adobe.  Everything I come across for the CS3 download gives me an error when I click on the Mac version to download (HTTP Error: 404/support/downloads/dlm/main.jsp).  I have switched off the pop up blocker as well and tried more than one browser when downloading.
    Does anyone have a work around?  I've paid over $4,000 for this software, I don't have the money to buy the latest version and I need to get my work done. I'm done with the stupidity of just trying to load this and I shouldn't have to buy the latest version just to be able to load my update.
    Please help if you can.
    SIncere thanks
    Hasmi

    you don't need to install cs3 in order to install your cs5 upgrade.  if you start the cs5 installation you will first be prompted for your cs5 serial number.  the installer will then 'look' for cs3 on your computer and failing to find that will then prompt you for your cs3 serial number thereby establishing that you qualify to install the cs5 upgrade.
    but if you want to install cs3:
    You can download some of the older versions of Adobe software directly from the Adobe website. See the following links for details.
    Accessible from these pages:
    Download and installation help
    Adobe Downloads - other downloads
    Downloads available:
    CS6 | CS5.5 | CS4 | CS3
    Acrobat XI, X | 9,8
    Premiere Elements 11, 10
    Photoshop Elements 11, 10
    or:
    if you follow all 7 steps, you can download a trial via one of the links on this page using a browser that accepts cookies:  http://prodesigntools.com/download-adobe-cs4-and-cs3-free-trials-here.html
    and activate with your serial number.
    if you have a download problem (eg, you see an error page or you are offered an incorrect version), you probably didn't follow all 7 steps.  typically, failure to meticulously follow steps 1,2 and/or 3 is the problem, but your browser must also allow cookies so that (a restrictive browser setting) is another potential source of problems.

  • I can't print to PDF from AutoCAD and can't find a phone number to call ADOBE for support. Very frustrated, please help.

    Trying to plot to PDF from AutoCAD. Never usually have issues doing so, a few months ago it stopped working suddenly with  a warning message that said Adobe PDF was not activated. I didn't know what to do so uninstalled and reinstalled it which fixed the problem. Only now it started happening again.... There must be an easier fix?
    Thanks for your help!

    Thank you for writing to me!
    It occurs when I try to print to Adobe PDF from either AutoCAD or Revit (both autodesk products). My Adobe PDF function seems to be working for other applications - for ex. if I save from Illustrator to PDF, Word to PDF, etc. From this description it sounds as if it's more of a problem with my Autodesk products, but the odd thing is that until recently I was able to print to PDF from both of them! This happened to me once before and I uninstalled and reinstalled ADOBE but I thought there must be a better way of dealing with it. Is the number of times you install the ADOBE CS6 limited? I worry that uninstalling/reinstalling it uses up some of my uses - even though it's on the same laptop.
    The error message I get is this:
    Thanks for your help,
    Lisa

  • Launch PDF from HTML and execute search

    Is it possible using JavaScript in an HTML doc to launch a PDF and execute a search.query with a passed-in search parameter? TIA

    Hello, George, thanks for following up.  I went into Advanced->Document Processing->Document JavaScripts and put the code at the top of the file outside of the dummy function declaration I had to insert to activate the edit button.  It looks like this:
    // Split the file path into an array
    var aPath = this.path.split("/");
    // Remove the last element, which is the file name
    aPath.pop();
    // Join the path elements back together and add the index file
    var cIdxPath = aPath.join("/") + "/Support Documents/SupDocs.pdx";
    search.query ("Enhanced Tactical Automated Security System (eTASS)", "Index", cIdxPath);
    function Search()
    It runs fine when I launch the PDF directly into the reader by double-clicking in file explorer in the folder above "Support Documents".  When I load the PDF from an HTML file in the same folder, however, the script does not run.  I set the reader preferences to force loading in the reader even when launched from a browser, and the script still will not execute.  I tried adding a button to the PDF and attaching the search script to it.  Again, it runs when launching directly but not from the HTML document.  Otherwise, the PDF is empty, and I'm using a relative URL and JS to load it from the HTML doc, such as:
    document.location = "mySearch.PDF"
    or
    window.open("mySearch.PDF", "searchwin");
    Neither one works.  This product has to run from a CD-ROM, so I haven't bothered to test it via http service.  Any suggestions?  Thanks again!
    Jon Camp
    Senior Computer Scientist
    Applied Research Associates, Inc.
    North Florida Division
    Training Solutions Group
    430 W 5th Street Suite 700
    Panama City, FL  32401
    comm: 850-914-3188 x203
    fax: 850-914-3189
    email: [email protected]

  • TS3218 I purchased music from Itunes and downloaded it but I can't sync it to my Ipod.

    I purschase some music from the Itune store and downloaded it. I can't sync the music to my Ipod

    What error did you get? Any error codes?

  • Returned from trip and downloaded several hundred photos. I photo will not allow identifying faces on most pictures. why and is there a fix

    Returned from trip and imported several hundred photos to Iphoto from a Nikon 3200.  I photo will not allow me to catalog Faces on most pictures. Some randomly will accept Faces.  Key words and Descriptions work.
    Why and how do I fix this?

    As a test launch iPhoto with the Option key held down and create a new, test library.  Import a few photos from your camera and test to see if the same problem persists. Does it?
    OT

  • Can I watch a movie that has been purchased or rented from itunes and downloaded to my ipad without internet access?

    I would like to be able to watch a movie while I'm camping and stuck in the camper due to inclement weather.  More than likely, I will not have access to the internet.  Is it possible to watch a movie that has been rented or purchased and downloaded to my ipad?

    I have seen conflicting answers about this issue recently.
    If you purchase a movie and it is fully downloaded to your iPad - yes you can watch it without an Internet connection.
    With a rental there seems to be two schools of thought. The first is just like the answer to a purchased movie - once fully download no Internet connection is needed. The other reply is that you need an internet connection in order to authorize playback and those who state this say that you can't play a rental without the Internet connection.
    I have never rented a movie but the second school of thought makes no sense to me. If the movie is downloaded and the authorization has already taken place, I see no reason to need the Internet connection. I have read stories of iPad users talking about watching rented movies on airplane flights so that would be without an Internet connection.

Maybe you are looking for

  • Acrobat 7--strange  behaviour

    I have a somewhat complex question...I am on an XP SR3 system. I have Acrobat 7 with the latest update. I have been scanning and recreating an old book in Ventura Publisher V.8. When it is formatted correctly I print it to pdf using the Distiller (al

  • How can I get the key list in ......

    The code such as UIManager.getColor("Table.selectionForeground") can get the default color of swing components,however,how I can get the key list on a swing component? Thanks a lot!

  • HT2822 How do I show a web page from my iPad on my tv?

    I am trying to sync my iPad 3 with my tv using apple tv so I can see whatever is on my iPad on my tv screen - I have managed photos but I can't get web pages? Can anyone help ?

  • Referencing "Form Variables" in Formcalc

    WIth LiveCycle Designer ES4 I'm trying to place a group of string variables used throughout my form so as not to have to edit the same variables in several places. I don't want to use Form Properties>Variables because one can't see the entire group a

  • ABAP-HR : - Email payslips to respective Empoyee

    Hi All, My requirement is to email payslips to respective employee . i found answer in sdn , it is working fine but my problem is i am getting standard form IN01 instea of my form ZACR i debugged the program,during that i found it is taking form as I