Issue saving a stamped document
Problem on converting from PDF to PowerPoint Arabic Data
Stamp on multiple pages after doc.Pages.Add()
When I create a new page for my document with
var page = doc.Pages.Add();
And add a floating box in it, that creates multiple pages as result, because of long text content, I cant access these other pages to add stamps to it.My doc.Pages have still just 1 page inside. I added an example project as attachment. I need the background.pdf on all generated pages and not just the first one. Could you help me with this?
aspose pdf - bookmarks gone after merge of files and licens key not working
I am using aspose pdf i a console application. I have a bunch of pdf files (no changes all the time) and I want to loop through all the files make a book mark in the file and afterwards merge the files into one. I have made a List wiht paths to the files and try to insert bookmarks using this example code form you reposit:
foreach (string s in Files)
{
string book = s.Substring(s.LastIndexOf("_"));
Document pdfDocument = new Document(s);
// Create a bookmark object
OutlineItemCollection pdfOutline = new OutlineItemCollection(pdfDocument.Outlines);
pdfOutline.Title = book;
pdfOutline.Italic = true;
pdfOutline.Bold = true;
// Set the destination page number
pdfOutline.Action = new Aspose.Pdf.InteractiveFeatures.GoToAction(pdfDocument.Pages[1]);
// Add bookmark in the document's outline collection.
pdfDocument.Outlines.Add(pdfOutline);
// Save output
pdfDocument.Save(s);
}
And afterwards i merge the files using this code:
foreach (string s in Files)
{
try
{
Document pdfDocument1 = new Document(s);
res.Pages.Add(pdfDocument1.Pages);
}
catch (Exception addex)
{
LogWriter.WriteLog("Error when adding file: " + addex.ToString());
}
}
It seems that my bookmark is added to the original files but when i try to merge the files the bookmarks are gone. Am I using the wrong approach?
and also my files come with a header that I am using a eval version (see picture example) but I have put the lic file in the debug bin and I have refered to it in the code like:
Aspose.Pdf.License license = new Aspose.Pdf.License();
license.SetLicense("Aspose.Pdf.lic");
I have made other applications where I do exactly the same and it works fine but maybe I have missed something here?
download pdf file from server, edit and save it on server
Issues converting PDF to Word Document
Public Sub ConvertPDFtoWord(ByVal pPDFDocName As String, ByVal pWordDocName As String)
Dim licensePDF As Aspose.Pdf.License = New Aspose.Pdf.License
licensePDF.SetLicense("Aspose.Total.lic")
Dim pdfDocument As Document = New Document(pPDFDocName)
Dim saveOptions As DocSaveOptions = New DocSaveOptions()
saveOptions.Format = DocSaveOptions.DocFormat.DocX
pdfDocument.Save(pWordDocName, saveOptions)
End Sub
I have a few issues with the generated Word document:
1. The PDF contains a mix of pages in portrait and landscape. The generated Word document contains the pages in the correct format, however when printed, the landscaped pages are being treated as portrait. Are there any options or parameters available that will modify the behavior of the generated Word document to correct this issue to mirror the format of the pages in the source PDF?
2. Some of the text in the generated Word document comes out strange. See the last page in the attached Word document for an example – notice how the 3 Contacts have been included in the report displays at the bottom of the page. It appears as though there are a number of spaces between the ‘u’ and ‘d’ in the word included. I have seen this behavior in other generated Word documents – this is just one example.
Can you help me with these issues?
Can Aspose.PDF generate WCAG accessible PDF files
Hi,
I need to find out if Apose.PDF can generated PDF files are tagged meaning in a WCAG accessible PDF fornat and are compliant with Section 508 accessability statands?
Some more information can be found at:
http://blogs.adobe.com/accessibility/2012/01/wcag-2-0-techniques-for-pdf.html
If so, can you please provide what verson of your software is compliant?
Thanks
Debbie
Issue Extracting Pages from PDF Document after upgrade to version 11.5
We are planning to upgrade to version 11.5 but have found a bug in the assembly whereby PDF files we could extract pages from in version 10.8 are now returning errors.
The code we are using is the following:
Aspose.Pdf.License AsposePDF = new Aspose.Pdf.License();
AsposePDF.SetLicense(licenseFile);
AsposePDF.Embedded = true;
string localTemplateFileName = @"filename";
//
using (FileStream templateStream = new FileStream(localTemplateFileName, FileMode.Open))
{
string FileName = string.Format("{0}_Page{1}_{2}.PDF", "DE_DE_E_138v1_1EOYTemplate", 2, Guid.NewGuid());
using (FileStream outputStream = new FileStream(FileName, FileMode.Create))
{
Aspose.Pdf.Facades.PdfFileEditor aspose = new Aspose.Pdf.Facades.PdfFileEditor();
aspose.AllowConcatenateExceptions = true;
bool extractResponse = aspose.Extract(templateStream, 2, 2, outputStream);
}
}
From some tests we have completed the issue appears to be where a field exists on multiple pages with the same field name.
The same field name is used on both Page 2 and Page 3.
Using Original.pdf I could extract Page 1, 4 & 5, but not 2 & 3.
Pages 2 and 3 have field names in common: TAXNO, TAXYEAR and COMPNAME.
If I remove these fields from either page 2 or page 3, then I am able to extract all pages.
I have attached a file which highlights the issue.
This works fine in 10.8 but returns an error in 11.5.
Regards,
Barry
Html to Pdf Exception
Thanks!
Concantenating PDFs generates a null reference
Now I am getting a null reference when I combine any PDF that is ASPOSE created.
I tried to go back to 10.4 but continue to get the errors.
System.NullReferenceException: Object reference not set to an instance of an object.
Aspose.Pdf.Facades.PdfFileEditor pdfEd = new Aspose.Pdf.Facades.PdfFileEditor();
foreach (var item in ultraListView1.Items)
{
if (item.CheckState == CheckState.Checked)
{
aDoc = localContext.ApplicationDocuments.Find(Guid.Parse(item.Key.ToString()));
f = new Aspose.Pdf.Facades.Form();
f.BindPdf(new MemoryStream(aDoc.DocumentBlob));
msDoc = new MemoryStream();
f.Save(msDoc);
msDocs.Add(msDoc);
}
}
msFinalPkg = new MemoryStream();
pdfEd.Concatenate(msDocs.ToArray(), msFinalPkg);
This worked with 10.4 except for the out of memory errors occasionally.
This seems to be very similar to:
http://www.aspose.com/community/forums/thread/715728/concatenating-pdfs-generated-by-aspose.pdf-fail-with-nullreferenceexception.aspx
Diagonal text watermark that appears only when printing?
Several conversion problems from PDF to PDF/A_1B
We are using aspose-pdf-11.4.0.jar library and we have several problems with differents pdf files.
The problems are the following:
- First problem:
Converting pdf file "test1.pdf" to pdf/a_1b format. We had found that aspose library is inserting a channel count of 4 for a RGB ICC profile.
PDF affected part:
5 0 obj
<</Filter/FlateDecode/N 4/Length 706>>stream.....etc
(replacing /N 4 to /N 3 work fine)
Using validator "https://www.pdf-online.com/osa/validate.aspx":
Validating file "test1.pdf" for conformance level pdfa-1b
The value of the key N is 4 but must be 3.
The document does not conform to the requested standard.
- Second problem:
Converting pdf file "test2.pdf" to pdf/a_1b format.
We had found that aspose library is doing a bad font size parsing in a FreeText annotation element (attribute /DS)
PDF affected parts:
/DS(font: 10.0pt Courier; color: #000000;)
Exception trace:
java.lang.NumberFormatException: For input string: "pt"
at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
at sun.misc.FloatingDecimal.parseDouble(Unknown Source)
at java.lang.Double.parseDouble(Unknown Source)
at java.lang.Double.valueOf(Unknown Source)
at com.aspose.pdf.TextStyle.<init>(Unknown Source)
at com.aspose.pdf.FreeTextAnnotation.getTextStyle(Unknown Source)
at com.aspose.pdf.FreeTextAnnotation.m1(Unknown Source)
at com.aspose.pdf.Page.m1(Unknown Source)
at com.aspose.pdf.Page.m2(Unknown Source)
at com.aspose.pdf.ADocument.m12(Unknown Source)
at com.aspose.pdf.ADocument.flatten(Unknown Source)
at com.aspose.pdf.Document.flatten(Unknown Source)
at com.aspose.pdf.internal.p93.z6.m2(Unknown Source)
at com.aspose.pdf.internal.p93.z7.m12(Unknown Source)
at com.aspose.pdf.internal.p93.z6.m1(Unknown Source)
at com.aspose.pdf.ADocument.m1(Unknown Source)
at com.aspose.pdf.Document.m1(Unknown Source)
at com.aspose.pdf.ADocument.convert(Unknown Source)
at com.aspose.pdf.Document.convert(Unknown Source)
at Main.main(Main.java:258)
- Third problem:
Converting pdf file "test3.pdf" to pdf/a_1b format. The conversion log file contains:
<Problem Severity="Error" Clause="6.9" Convertable="True">Acroform is enabled</Problem>
<</Type/Catalog/AcroForm<</SigFlags 3/Fields[]/DA(/Helv 0 Tf 0 g )>>/Pages 5 0 R/Metadata 46 0 R/OutputIntents[33 0 R]>>
Possible fix:
If fields element is empty not insert AcroForm element. The signature field was removed but the signature appearance exists (I think that this conversion part is correct):
<</Contents 17 0 R/Type/Page/Resources<</ProcSet[/PDF/Text]/Font 7 0 R/XObject<</FRM0 16 0 R>>>>/Parent 5 0 R/Rotate 0/MediaBox[0 0 595 842]>>
(16 0 object reference the signature appearance).
rotate text and images
Is it possible to rotate text and images while they are being added to the pdf dynamically?
Something like:
image.rotation = 90;
or text.roration = 180;
Thanks,
Searchable PDF C#
Evaluation Only. Created with Aspose.Pdf. Copyright 2002-2014 Aspose Pty Ltd.
Replacement of phrases -> Setter for TextFragements?
Convert XFA pdf to a standard PDF
We would like to have a solution for an existing issue created in your "public" forum.
The ID of the issue : PDFNEWNET-38460
In attach the XFA PDF.
The code used :
Aspose.Pdf.License licenceP = new Aspose.Pdf.License();
licenceP.SetLicense(@"C:\Users\x30358\PersonnelProject\TEST Conversion\TEST Conversion\Aspose.Total.lic");
string fileName = @"C:\Users\Public\Documents\IconvertWatcher\Fiches Modulis fabien.pdf";
string FileNameOut = @"C:\Users\Public\Documents\IconvertWatcher\Fiches Modulis fabien_Flatten.pdf";
Aspose.Pdf.Document document = new Aspose.Pdf.Document(fileName);
document.Form.Type = Aspose.Pdf.InteractiveFeatures.Forms.FormType.Standard;
document.Flatten();
document.Save(FileNameOut);
Thanks.
Locking all threads on the server
com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(fileLoc);
PageCollection pages = pdfDocument.getPages();
java.io.OutputStream imageStream = new java.io.FileOutputStream(pdf);
// Create Resolution object
com.aspose.pdf.devices.Resolution resolution = new com.aspose.pdf.devices.Resolution(20);
// Create PngDevice object with particular resolution
com.aspose.pdf.devices.PngDevice pngDevice = new com.aspose.pdf.devices.PngDevice(WIDTH, HEIGHT, resolution);
// Convert a particular page and save the image to stream
pngDevice.process(pages.get_Item(page), imageStream);
// Close the stream
imageStream.close();
Thread dump:
"http-nio-8080-exec-43" daemon prio=3 tid=0x0000000001df5800 nid=0xda waiting for monitor entry [0xfffffd7fea24e000]
java.lang.Thread.State: BLOCKED (on object monitor)
at com.aspose.pdf.internal.p48.z15.m8(Unknown Source)
- waiting to lock <0x000000006b164ab0> (a java.lang.Object)
at com.aspose.pdf.internal.p48.z15.m7(Unknown Source)
at com.aspose.pdf.internal.p48.z15.m1(Unknown Source)
at com.aspose.pdf.internal.p50.z1.m1(Unknown Source)
at com.aspose.pdf.internal.p48.z29.m9(Unknown Source)
at com.aspose.pdf.internal.p48.z29.m16(Unknown Source)
at com.aspose.pdf.internal.p38.z3.m1(Unknown Source)
at com.aspose.pdf.internal.p27.z20.m2(Unknown Source)
at com.aspose.pdf.internal.p27.z20.m4(Unknown Source)
at com.aspose.pdf.internal.p27.z7.m2(Unknown Source)
at com.aspose.pdf.internal.p27.z7.m1(Unknown Source)
at com.aspose.pdf.devices.z1.m1(Unknown Source)
- locked <0x000000007aa45090> (a com.aspose.pdf.Document)
at com.aspose.pdf.devices.z1.m1(Unknown Source)
at com.aspose.pdf.devices.ImageDevice.m1(Unknown Source)
at com.aspose.pdf.devices.PngDevice.processInternal(Unknown Source)
at com.aspose.pdf.devices.PngDevice.process(Unknown Source)
at hub.app.service.document.DocumentPreviewHelper.getPreviewImages(DocumentPreviewHelper.java:483)
at hub.api.rest.InternalDocPreviewRestService.getPreviewImages(InternalDocPreviewRestService.java:107)
at sun.reflect.GeneratedMethodAccessor1110.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:540)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:715)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:516)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1086)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:659)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1558)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1515)
- locked <0x000000007a3b7938> (a org.apache.tomcat.util.net.NioChannel)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:744)
<snip>..
Document font and layout changes when saved
Env: .Net 4.0, Aspose.PDF 11.5.0. This issue does not happen on Aspose.Pdf 10.3.0 version.
I am trying to search for a specific text and remove it. See attached document:slow.pdf and output.pdf.
This is my code:
String MYTEXT = "{{t:s;r:y;o:”Insured”;}}";
Aspose.Pdf.Text.TextFragmentAbsorber textFragmentAbsorber = new Aspose.Pdf.Text.TextFragmentAbsorber(MYTEXT);
Aspose.Pdf.Text.TextOptions.TextSearchOptions textSearchOptions =
new Aspose.Pdf.Text.TextOptions.TextSearchOptions(true);
textFragmentAbsorber.TextSearchOptions = textSearchOptions;
pdfDocument.Pages.Accept(textFragmentAbsorber);
Aspose.Pdf.Text.TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;
foreach (Aspose.Pdf.Text.TextFragment textFragment in textFragmentCollection)
{
var tabs = new StringBuilder();
tabs.Append(' ', textFragment.Text.Length + 20); // replace empty space
textFragment.Text = tabs.ToString();
}
pdfDocument.Save(root + "/"+id+".pdf");
I noticed that document is changing in its font as seen in output.pdf document. Moreover, when opened in Abode Acrobat reader, I see an error message that says: "Cannot extract the embedded font FAAAAI+TimesNewRomanPSMT". Some characters may not display or print correctly. This does not happen with the input file 'slow.pdf'.
Can you please tell me how I can preserve font, gaps and original structure of the document with an example? Is this is a bug? Or is Document.Save() function buggy on Aspose.pdf 11.5.0?
I don't see any issues when I use Aspose.pdf10.3.0
Also note that the original input document is created via Aspose .NET 9.9.0 as seen in document_details.png attachment.
Thank you,
Sireesha