Exception on Flattening PDF
Attached document does not raise "Invalid Password" when Document object is constructed
PngDevice.Process cutting off image
We are converting PDF files to PNG files using PngDevice.Process. For most documents, it works fine, but we have a few where the process is cutting off the right side of the drawing. A few notes:
- If we use a resolution of 100 DPI, it works fine
- If we use a resolution of 200 DPI, it cuts off more than at 300 DPI
- JpegDevice.Process gives the same results
I have attached a copy of the original PDF as well as 100, 200, and 300 DPI converted copies. Does anyone have any ideas? The code being used is below:
Aspose.Pdf.
License license = new Aspose.Pdf.License();license.Embedded =
true;license.SetLicense(
"Aspose.Total.lic");Aspose.Pdf.
Document asposeDoc = null;string fileName = @"C:\Users\q41775\Desktop\Aspose Test Docs\71154001.pdf";string exportFileName = @"C:\Users\q41775\Desktop\Aspose Test Docs\exported\71154001_" + txtResolution.Text + ".png";if (System.IO.File.Exists(exportFileName)){
System.IO.
File.Delete(exportFileName);}
asposeDoc =
new Aspose.Pdf.Document(fileName);Resolution resolution = newResolution(Convert.ToInt32(txtResolution.Text));PngDevice pngDevice = newPngDevice(resolution);pngDevice.Process(asposeDoc.Pages[1], exportFileName);Image to pdf conversion not work when using Aspose.Pdf
Add HTML Code/File to Footer?
it is possible to add formatted Text as HTML in a footer? I need some text in Bold and some Text underlined.
How can i do this?
Thanks in advance.
Winfried
Aspose.pdf for .net 9.1.0.0.
How to read PDF with multiple columns
Can't open password encrypted PDF's created with Foxit PhantomPDF Printer
PDF security permissions
PDF Javascript at TextFragment or TextSegment level??
Add some javascript that will be invoked when a reader clicks on a word or other section of text.
fragment.Actions.OnClick =
or this...
segment.Actions.OnClick =
Link Border and Alignment Errors
Aspose pdf rectangle bug
pdf.save() keeps working inflating the size upto 1G and works forever
Object reference not set to an instance of an object opening PDF file
We are doing PDF to XPS and JPG conversions. On a few PDF files, we get an 'Object reference not set to an instance of an object' NullReferenceException when opening the PDF. Below is the code (the paste didn't take well, but you get the idea). The last line is where it throws the exception, and taking out the licensing portion doesn't matter. I have attached one of the failing PDF files. We are using version 8.7.0.0.
We are a paying customer and this is production code and is a high-priority issue. Can you help?
Aspose.Pdf.
License license = new Aspose.Pdf.License();
license.Embedded =
true;
license.SetLicense(
"Aspose.Total.lic");
Aspose.Pdf.
Document asposeDoc = null;
string fileName = @"C:\Users\q41775\Downloads\EC_8303-X-26238-001[1].pdf";
asposeDoc =
new Aspose.Pdf.Document(fileName);
Tiny Fonts on fillField
Text flowing around images
Microsoft office files to PDF
TextAbsorber - How to parse \r\n ?
ThreadAbortException on call to Aspose.Pdf.Generator.Pdf.Save(String fileName, SaveType saveType, HttpResponse response)
I have a user control (.NET 4.0 using Aspose.Pdf for .NET v9.4.0) which attempts to convert the current rendered html to a pdf file.
Works on local dev machine but not on the server as it throws a ThreadAbortException.
The user control is placed on a page in the CMS (Umbraco v6)
I have deployed the dll file "Aspose.Pdf.dll" to the bin folder on the server, any other files require deployment to the server? (Sorry new user of Aspose.Pdf so not sure if I have missed anything)
Any ideas what is causing this error?
Exception & code below ...
Thanks,
Chris.
An exception occurred in .
Action: CreateCurrentPageAsPDF
Exception: System.Threading.ThreadAbortException: Thread was being aborted.
at System.Threading.Thread.AbortInternal()
at System.Threading.Thread.Abort(Object stateInfo)
at System.Web.HttpResponse.AbortCurrentThread()
at Aspose.Pdf.Generator.Pdf.Save(String fileName, SaveType saveType, HttpResponse response)
at CreateCurrentPageAsPDF()
Code ...
protected override void Render(HtmlTextWriter writer)
{
// setup a TextWriter to capture the markup
TextWriter tw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(tw);
// render the markup into our surrogate TextWriter
base.Render(htw);
// get the captured markup as a string
string pageSource = tw.ToString();
// render the markup into the output stream verbatim
writer.Write(pageSource);
Session[SESSION_NAMEKEY_PDF_CONTENT] = pageSource;
}
private void CreateCurrentPageAsPDF()
{
if(null != Session[SESSION_NAMEKEY_PDF_CONTENT])
{
try
{
string pageSource = Session[SESSION_NAMEKEY_PDF_CONTENT].ToString();
Aspose.Pdf.License license = new Aspose.Pdf.License();
license.SetLicense(Server.MapPath("/AsposeLicense/Aspose.Pdf.lic"));
//Instantiate an object PDF class
Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
//Add the section to PDF document sections collection
Aspose.Pdf.Generator.Section section = pdf.Sections.Add();
Aspose.Pdf.Generator.Text pdfText = new Aspose.Pdf.Generator.Text(pageSource);
pdfText.IsHtmlTagSupported = true;
section.Paragraphs.Add(pdfText);
pdf.Save("Results.pdf", Aspose.Pdf.Generator.SaveType.OpenInBrowser, this.Response);
}
catch(System.Exception ex)
{
if(true == WriteExceptionsToEventLog)
{
WriteToEventLog(ex, "CreateCurrentPageAsPDF");
}
else
{
throw;
}
}
}
}
Pdf.net TextFragment properties
Images conversion without borders
How can i use all pdf page to occupy entire page space for image?
(see attached image originale and pdf resulting - password for pdf is "master")
i use this code:
MemoryStream oMTempStream = new MemoryStream();
Aspose.Imaging.ImageOptions.PngOptions OptionsI = new Aspose.Imaging.ImageOptions.PngOptions();
((Aspose.Imaging.Image)m_oDocument).Save(oMTempStream, OptionsI);
Aspose.Pdf.Generator.Pdf oPdf = new Aspose.Pdf.Generator.Pdf();
Aspose.Pdf.Generator.Section oSection = new Aspose.Pdf.Generator.Section();
oSection.PageInfo.Margin.Bottom = 0;
oSection.PageInfo.PageBorderMargin.Bottom = 0;
if (((Aspose.Imaging.Image)m_oDocument).Width > ((Aspose.Imaging.Image)m_oDocument).Height)
{
oPdf.IsLandscape = true;
float iW =oSection.PageInfo.PageWidth;
float iH = oSection.PageInfo.PageHeight;
oSection.PageInfo.PageWidth = iH;
oSection.PageInfo.PageHeight = iW;
}
oPdf.Sections.Add(oSection);
Aspose.Pdf.Generator.Image image1 = new Aspose.Pdf.Generator.Image(oPdf.Sections[0]);
image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Png;
oPdf.Sections[0].Paragraphs.Add(image1);
image1.ImageInfo.ImageStream = oMTempStream;
oPdf.Save(_oOutputStream);
oMTempStream.Dispose();