pdfCrowd Failing on live site - c#

I currently started using pdfCrowd for my website so users can download html as pdfs. I tested locally and it worked fine however when deploying it onto a actual website if failed with the following message:
System.Exception: Error downloading file. Please try again. --->
System.Exception: Error during rendering of Document to Pdf --->
pdfcrowd.Error: Exception of type 'pdfcrowd.Error' was thrown.
at pdfcrowd.HtmlToPdfClient.convertString(String text)...
My code in .NET looks like the following:
pdfcrowd.HtmlToPdfClient api = new pdfcrowd.HtmlToPdfClient("xxxusernamexxx", "xxxapi-keyxxx");
api.setPageMargins("3mm", "3mm","3mm", "3mm");
byte[] fileData = api.convertString(htmlString);
Not sure if I'm using the API correctly and whether I need to wait to the conversion for the html (which I insert as a string). Any incite would be helpful.

Related

Docx to pdf in Microsoft Graph Api failing with error "WordCantOpenDocument"

We are doing a docx-PDF conversion by uploading a Word-document(docx) by first uploading it using the large document upload in Microsoft Graph API (link) and after that downloading it to PDF-format (link)
The documents are modified using Open XML SDK for .NET. Mostly the whole process works fine but sometimes we get issues that we believe to be due to some XML-formatting within the documents. The error that we then get from the endpoint is:
Inner error: OfficeConversion_BadRequest
ErrorCode: WordCantOpenDocument
The actual Word-documents can be opened manually with no issues and even exported to PDF using the built in solution in Microsoft Word, but for some reason the conversion fails when doing this through the Graph endpoint.
The errors are, as you can see, quite non-informative and I'm wondering if there are any ways of investigating the issues any further and maybe get more logging information from MSFT?

Excel to Pdf in C# using Pdftron

I am trying to convert an Excel document into PDF in a ASP.Net Web application using Pdftron (Pdfnet) library.
Following is my code for the above purpose.
pdf.PDF.PDFDoc newSalaryFitmentPdf = new pdf.PDF.PDFDoc();
pdftron.PDF.Convert.ToPdf(newSalaryFitmentPdf, newSalaryFitmentExcel.FullName);
salaryFitment = newSalaryFitmentPdf.Save(pdf.SDF.SDFDoc.SaveOptions.e_linearized);
But I am getting the following exception when the program is trying to execute the second line.
Exception:
Message: An error occurred while converting the file.
Detailed error:
Error creating a new Excel application instance.
Code: PDFTRON_UNKNOWN (-2147024891)
File: "Excel.cpp":51
Log:
Start check system account.
Session ID is: 0.
Failed to create Desktop folder in SystemProfile. boost::filesystem::create_directory: Access is denied: "C:\Windows\system32\config\systemprofile\Desktop"
Failed to create Desktop folder in SystemProfile. boost::filesystem::create_directory: Access is denied: "C:\Windows\SysWOW64\config\systemprofile\Desktop"
Done checking system account.
Creating an Excel application instance.
Conditional expression: false
Version : 6.7.1.61823N
Filename : Convert.cpp
Function : trn::PDF::Convert::ToPdf
Linenumber : 1692
Any help would be highly appreciated.
Failed to create Desktop folder in SystemProfile. boost::filesystem::create_directory: Access is denied: "C:\Windows\system32\config\systemprofile\Desktop"
Failed to create Desktop folder in SystemProfile. boost::filesystem::create_directory: Access is denied: "C:\Windows\SysWOW64\config\systemprofile\Desktop"
You must set your application to have read/write access to these directories. Please see this article for further information.

Printing Telerik reports using ReportProcessor class

Firstly let me describe my setup.
I have a REST Telerik Reporting service. The service operates with TRDX file (have a requirement to have reports in this template format). I also have a console application, which is periodically started by a windows service. This console application uses ReportProcessor class to print reports directly to a printer.
Now the problem.
ReportProcessor throws an exception when trying to access the reports using UriReportSource, when these report files are hosted in IIS together with the REST Reporting service. Browsing and Anonymous Authentication are enabled on IIS for the Reports folder. The error that's thrown is:
The remote server returned an error: (404) not found.
However reports are printed when TRDX files are located in the same folder as the console application.
Solved my own question by trial and error.
My reports were located in the REST service's subdirectory. So I was trying to set the Uri to the reports URL something like this:
UriReportSource reportSource = new UriReportSource {
Uri = "http://localhost/myTelerikRESTService/Reports/samplereport.trdx"
};
And I was obviously getting 404 error since the request to the that path would be handled by the service.
Trying to specify a physical path (c:\inetpub\wwwroot\myTelerikService\Reports\samplereport.trdx) also ended up in error: something like the path format is not supported.
Finally I've tried this Uri: /inetpub/wwwroot/myTelerikService/Reports/samplereport.trdx, that maps to the physical location.
And it worked!
EDIT:
I really should've read this https://www.w3.org/Addressing/URL/uri-spec.html before working on this issue. Apparently I had no firm understanding of what a URI is! Feeling really dumb now.....

asp.NET - dataset.xsd failed to generate code after being uploaded to domain

I've recently been working on a small website for a friend, after creating the website, where all works as intended, it stops working when being uploaded to the server.
So far I know that the Dataset.xsd is unable to generate the needed code based on the .xsd file, and that it has something to do with the fact, that the file locations are being changed. All of this I've learned by browsing here.
I use MySQL, and my target server uses phpMyAdmin, so I can't use remote access.
Is there a workaround for this, or what am I doing wrong?
The error occurs at Line 1:
<?xml version="1.0" encoding="utf-8"?>
With this exception
Failed to generate code. Exception of type 'System.Data.Design.InternalException' was thrown.

Accessing Google Spreadsheets with C# using Google Data API fails with Mono

I'm trying to access my Google spreadsheets using the GData API. I have followed the example which looks like:
var service = new SpreadsheetsService("myTest");
service.setUserCredentials(username, password);
var query = new SpreadsheetQuery();
var feed = service.Query(query);
This should return a feed with a list of spreadsheets. However this fails with:
Google.GData.Client.GDataRequestException: Execution of request failed: http://spreadsheets.google.com/feeds/spreadsheets/private/full ---> System.Net.WebException: The remote server returned an error: (404) Not Found.
When I try the above link directly in my browser I'm able to download the feed, as long as I'm logged in into my Google account.
Some further information:
I'm not behind a firewall
I have checked my username (maurits.rijk at gmail.com) and password several times
I am using Mandriva in VirtualBox on a MacBook
All my code is compiled with Mono
I tried the same functionality in Java on OS-X. That code runs as expected.
Looks like a Mono problem to me.
Could you test with fiddler to test if your call reach the server?
I found the problem and solution on Google code, Issue 88 as comment 8.
In short, using
mozroots --import --sync --quiet
solves this problem. For me it now works.

Categories