Sign In  Sign Up Live-Chat

Error generating PDF from Sharepoint URL

Last post 01-31-2008, 12:00 PM by AdeelTaseer. 17 replies.
Page 1 of 2 (18 items)   1 2 Next >
Sort Posts: Previous Next
  •  12-19-2007, 10:37 AM 106730

    Error generating PDF from Sharepoint URL

    Received : 2007/12/19 10:37:09

    Hi, 

    We are encountering  error while using ASPOSE.PDF. the detail;s are as below.

    The problem is that it is giving unauthorized error when a sharepoint url or any content in sharepoint is referred directly as url. The below code is giving error. If this is solved, then we can generate PDF directly.

    Points to note are that the account which is trying to access the url has access to sharepoint. Also, we have tried different kinds of impersonation.

    Pdf objPdf = new Pdf();

    License li = new License();

    li.SetLicense("Aspose.Total.lic");

    string url = "
    http://blrkec56945d:1112/sites/DSR3/PublishingImages/Forms/AllItems.aspx";

    objPdf.BindHTMLFromUrl(url);

    We are getting the below error message in event log. See if you can contact ASPOSE product/support team to resolve this issue.

    -----------------------------------------------------------------------------------

    Event code: 3005

    Event message: An unhandled exception has occurred.

    Event time: 12/18/2007 4:55:26 PM

    Event time (UTC): 12/18/2007 11:25:26 AM Event ID: 2daf81b0a2054b1293228d18b54e6769 Event sequence: 10 Event occurrence: 3 Event detail code: 0

     

    Application information:

    Application domain: 9da74934-6-128424500846332651

    Trust level: Full

    Application Virtual Path: /TempSite

    Application Path: E:\Temp\TempSite\

    Machine name: BLRKEC56945D

     

    Process information:

    Process ID: 240

    Process name: WebDev.WebServer.EXE

    Account name: BLRKEC56945D\blrkec56945dadm

     

    Exception information:

    Exception type: WebException

    Exception message: The remote server returned an error: (401) Unauthorized.

     

    Request information:

    Request URL:
    http://localhost:3740/TempSite/Default2.aspx

    Request path: /TempSite/Default2.aspx

    User host address: 127.0.0.1

    User: BLRKEC56945D\blrkec56945dadm

    Is authenticated: True

    Authentication Type: NTLM

    Thread account name: BLRKEC56945D\blrkec56945dadm

     

    Thread information:

    Thread ID: 4

    Thread account name: BLRKEC56945D\blrkec56945dadm

    Is impersonating: False

    Stack trace: at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)

    at System.Net.WebClient.DownloadData(Uri address)

    at System.Net.WebClient.DownloadData(String address)

    at Aspose.Pdf.Pdf.BindHTMLFromUrl(String url)

    at Default2.Page_Load(Object sender, EventArgs e) in e:\Temp\TempSite\Default2.aspx.cs:line 25

    at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)

    at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)

    at System.Web.UI.Control.OnLoad(EventArgs e)

    at System.Web.UI.Control.LoadRecursive()

    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    Custom event details:

    For more information, see Help and Support Center at. etc.

    Please advice us on how to solve this.

     


    This message was posted using Aspose.Live 2 Forum
     
  •  12-19-2007, 11:06 AM 106736 in reply to 106730

    Re: Error generating PDF from Sharepoint URL

    Hi,

    Please refer to http://aspnet.4guysfromrolla.com/articles/102605-1.aspx for information on how to make authenticated HTTP requests. I think this will solve our problems.

    Thanks.

     
  •  12-20-2007, 11:03 PM 106937 in reply to 106736

    Re: Error generating PDF from Sharepoint URL

    Hi Adeel,

    We have tried using the webclient object of .NET to download the sharepoint page as html and pass it to ASPOSE PDF BindHTML method and it generates PDF.

    But if the resulting html has some reference to sharepoint resource (like image in Sharepoint library <img src = http://sharepointserver/Publishingimages/img1.jpg />), again it fails and throws unauthorized error. So, our problem is not solved by using webclient.

    Is there a way to make authenticated http request using ASPOSE BindHTMLFromUrl("required url") method. Is there any property which we can set to make authenticated request.

    Thanks.

     
  •  12-26-2007, 3:01 AM 107134 in reply to 106937

    Re: Error generating PDF from Sharepoint URL

    Hi,

    I will discuss this issue with developers and let you know.

    Thanks.

     
  •  12-29-2007, 6:44 AM 107340 in reply to 107134

    Re: Error generating PDF from Sharepoint URL

    Thanks Adeel. Do let me know once you find a resolution for this.
     
  •  12-29-2007, 6:38 PM 107344 in reply to 107340

    Re: Error generating PDF from Sharepoint URL

    This issue has been logged as PDFNET-4229. Basically we have found solution for this problem. The developer will provide a ETA soon.

    Tommy Wang
    Lead Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  12-31-2007, 12:56 AM 107363 in reply to 107344

    Re: Error generating PDF from Sharepoint URL

    I have uploaded the solution to team leader, so after his approval and our production rebuilding, maybe within one week you will get the answer.

    good luck! ^-^

    Soldier Huang
    Product Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  01-02-2008, 4:44 AM 107458 in reply to 107363

    Re: Error generating PDF from Sharepoint URL

    Thanks a lot. Waiting eagerly to get the new build.
     
  •  01-09-2008, 5:27 AM 108246 in reply to 107458

    Re: Error generating PDF from Sharepoint URL

    Is the solution ready. Can pls upload the code
     
  •  01-09-2008, 8:11 AM 108279 in reply to 108246

    Re: Error generating PDF from Sharepoint URL

    Hi,

    I will ask the developer working on this to give you an ETA.

    Thanks.

     
  •  01-10-2008, 8:31 PM 108557 in reply to 108279

    Re: Error generating PDF from Sharepoint URL

    Hi,

    We have not finished the QA work for the new version. We will try to provide a beta version to you early next week.

    Tommy Wang
    Lead Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  01-25-2008, 12:08 AM 110389 in reply to 108557

    Re: Error generating PDF from Sharepoint URL

    Hi,

    Do you have the new build with fixes for fetching images from Sharepoint for generating PDF. Can you please share the latest builld. This is very important for us and we will not be able to release our application without this. So, kindly post the new build asap.

     

    Thanks in Advance,

    DSR

     
  •  01-25-2008, 7:04 AM 110433 in reply to 110389

    Re: Error generating PDF from Sharepoint URL

    Attachment: Present (inaccessible)

    Hi,

    The problem has been resolved. Please try the attached dll before our new hotfix. Thanks.

    Best regards.


    Hans Zhang
    Product Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  01-28-2008, 3:45 AM 110646 in reply to 110433

    Re: Error generating PDF from Sharepoint URL

    Hi

          We tried to generate pdf using the following code and the new dll provided by you. However, we got the same exception i.e. 

    "The remote server returned an error: (401) Unauthorized."

    We got the above exception when the image url pointed to an image located inside a sharepoint site. It worked fine for an image present in the local system.

    Code Used

    Pdf pdf = new Pdf();

    Aspose.Pdf.License lic = new Aspose.Pdf.License();

    lic.SetLicense(@"C:/npdf/Aspose.Total.lic");

    System.Net.WebClient webClient = new System.Net.WebClient();

    webClient.Credentials = CredentialCache.DefaultNetworkCredentials;

    Section objSec;

    objSec = pdf.Sections.Add();

    Aspose.Pdf.Image objChart1Img = new Aspose.Pdf.Image(objSec);

    objChart1Img.ImageInfo.File = http://blrkec56945d:1112/sites/DSR3/PublishingImages/bargraph1.bmp;

    objChart1Img.ImageInfo.FixWidth = 200;

    objChart1Img.ImageInfo.FixHeight = 200;

    objSec.Paragraphs.Add(objChart1Img);

    pdf.Save(@"C:/npdf/11.pdf");

         Kindly provide a solution soon as we are unable to release our application due to this problem.

     

     
  •  01-28-2008, 7:36 AM 110691 in reply to 110646

    Re: Error generating PDF from Sharepoint URL

    Hi sharada,

    Thanks you for considering Aspose.

    We suggest you change the code as following:

    Pdf pdf = new Pdf();

    Aspose.Pdf.License lic = new Aspose.Pdf.License();
    lic.SetLicense(@"C:/npdf/Aspose.Total.lic");

    Pdf.Credentials = new NetworkCredential("loginName", "loginPassword");

    Section objSec;
    objSec = pdf.Sections.Add();

    Aspose.Pdf.Image objChart1Img = new Aspose.Pdf.Image(objSec);
    objChart1Img.ImageInfo.File = "http://blrkec56945d:1112/sites/DSR3/PublishingImages/bargraph1.bmp";

    objChart1Img.ImageInfo.FixWidth = 200;
    objChart1Img.ImageInfo.FixHeight = 200;
    objSec.Paragraphs.Add(objChart1Img);

    pdf.Save(@"C:/npdf/11.pdf");

    Please pay attention to the parameters "loginName" and "loginPassword" which mean you should have an account on the remote sharepoint machine with the name "loginName" and password "loginPassword".


    Tommy Wang
    Lead Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
Page 1 of 2 (18 items)   1 2 Next >
View as RSS news feed in XML