Font not found in linux
Table row in new pdf page using Aspose.Pdf.generator
BUG: System.IO.EndOfStreamException when converting PDF to DOC
Need help in document conversion
PDF Form - File corrupted
Good Morning,
We have a problem with the generation PDF Form File,
The first and second PDF File have a error (FileCorrupted1.pdf and FileCorrupted2.pdf)
This file is correct(Correct.pdf), but the three file have been generated from the same template(Template.pdf).
The problem is not present all the time, it's weird.
Do you any idea for our problem?
This is our code Aspose 10.4, the same code with Aspose 8.2 is all the time correct.
'Get Template
objStrmFichPDFEntre = New MemoryStream(_bytFichPDFBin)
objForm = New Aspose.Pdf.Facades.Form(objStrmFichPDFEntre)
'Fill Fields
objForm.BindPdf(objStrmFichPDFEntre)
objForm.FillField("TxtNomImprimante","\\IMPPRODQUE2\Q800")
objForm.FillField("TxtNomDocument","RBI_CRF5_26799666")
objForm.FillField("TxtLot","1 de 1")
objForm.FillField("TxtExpediteur","BJE5")
objForm.FillField("TxtDepot","B280")
objForm.FillField("TxtPage","12")
objForm.FillField("TxtDate","2015-09-24 13:54:26")
objForm.FillField("TxtProcessusManutention","Processus 1 (nombre de page(s): 12)")
objForm.FlattenAllFields()
objStrmFichPDFSorti = New MemoryStream
objForm.Save(objStrmFichPDFSorti)
Thank you
Extract each field from PDF one by one
Please check the attached document. It contains a lot of information about employees that we would like to extract one by one. For example, I would like to get the Employee's Social Security number, Identification Number (EIN), Name, address and ZIP code, and other fields.
If I convert the document to Excel directly, it is extracting the data in various rows and columns that is not desirable.
Is there any way that I can extract each field from the PDF file one by one and store it in database? A quick response is highly appreciated about this.
PDF Split
Rendering File issue : Checkbox is unchecked in the stamped document
Multithreaded JPEG to PDF conversion
I have a problem with code performing a conversion from JPEG to PDF, when executing from multiple threads. The execution below takes ~ 6 sec to complete with 1 thread, but if the number of threads are increased to 10 it tasks ~ 122 sec. It seems that some internal resource prevents executing Pdf.save from multiple independent threads. Could we find out the reason of this behavior and if there are some solutions to it.
I would like to avoid synchronizing the calls
Using aspose.pdf-10.8.0.jar.
package test;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.apache.log4j.Logger;
import aspose.pdf.ImageFileType;
import aspose.pdf.MarginInfo;
import aspose.pdf.Pdf;
import aspose.pdf.Section;
public class JPEGConversionIssue {
static private Logger logger = Logger.getLogger(JPEGConversionIssue.class);
public static void main(String[] args) throws Exception {
long time = System.currentTimeMillis();
ExecutorService executor = Executors.newFixedThreadPool(10); //try running in 1 thread
for (int i = 0; i < 15; ++i) {
executor.execute(new ThreadRunner());
}
executor.shutdown();
executor.awaitTermination(Integer.MAX_VALUE, TimeUnit.SECONDS);
System.out.println("transformation took: " + (System.currentTimeMillis() - time) + " ms");
}
public static class ThreadRunner implements Runnable {
@Override
public void run() {
try {
logger.info("convertion.start");
FileInputStream fileInputStream = new FileInputStream("C:/Users/Denis/Desktop/image.jpeg");
byte data[] = new byte[fileInputStream.available()];
fileInputStream.read(data);
fileInputStream.close();
ByteArrayInputStream inputStream = new ByteArrayInputStream(data);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
Pdf pdf = new Pdf();
Section section = pdf.getSections().add();
MarginInfo marginInfo = new MarginInfo();
marginInfo.setTop(5);
marginInfo.setRight(5);
marginInfo.setBottom(5);
marginInfo.setLeft(5);
section.getPageInfo().setMargin(marginInfo);
aspose.pdf.Image image = new aspose.pdf.Image(section);
section.getParagraphs().add(image);
int imageFileType = -1;
imageFileType = ImageFileType.Jpeg;
image.getImageInfo().setImageFileType(imageFileType);
image.getImageInfo().setImageStream(inputStream);
pdf.save(outputStream);
FileOutputStream out = new FileOutputStream("out/" + Thread.currentThread().getName() + "." + System.currentTimeMillis() + ".pdf");
out.write(outputStream.toByteArray());
out.close();
logger.info("convertion.done");
} catch (Exception e) {
e.printStackTrace();
logger.error(e);
}
}
}
}
Aspose Disposition
Converting word document to PDF/A 3B (PDF v1.7) - overlapped text
I am using last versions of Aspose.Words and Aspose.Pdf .NET to convert word documents to PDF/A 3B (v1.7) because of mandatory using of pades in european union since 1st July 2016.
At first I save the word document with aspose. words to PDF v1.5 then I convert it using Aspose.PDF to PDF v1.7 and then finaly convert it to PDF/A 3B
Code snippet:
Public Function ConvertToPDFA(Bytes() As Byte) As Byte() Implements IConverterPDFA.ConvertToPDFA
Dim InStream As New MemoryStream(Bytes)
Dim OutStream As New MemoryStream()
Dim Word As New Aspose.Words.Document(InStream)
Dim PDFAOptions As New Aspose.Words.Saving.PdfSaveOptions()
PDFAOptions.Compliance = Aspose.Words.Saving.PdfCompliance.Pdf15
PDFAOptions.FontEmbeddingMode = Aspose.Words.Saving.PdfFontEmbeddingMode.EmbedAll
Word.Save(OutStream, PDFAOptions)
Dim OutStreamPDFA3 As New MemoryStream()
Dim ms As New MemoryStream
Dim pdf As New Aspose.Pdf.Document(OutStream)
pdf.Convert(ms, Aspose.Pdf.PdfFormat.v_1_7, Aspose.Pdf.ConvertErrorAction.Delete)
ms.Close()
ms.Dispose()
ms = New MemoryStream
pdf.Convert(ms, Aspose.Pdf.PdfFormat.PDF_A_3B, Aspose.Pdf.ConvertErrorAction.Delete)
pdf.Optimize()
pdf.OptimizeResources()
pdf.Save(OutStreamPDFA3)
ms.Dispose()
Return OutStreamPDFA3.ToArray
End Function
The problem is that after last step is performed the text in document is overlapped. Example document in attachment. I would really need this fixed before 1st July.
Thank Pilscom
HTML to PDF - Images are not displayed from Shared Floder
Change Advanced Print Setup options
Indented TOC on an existing PDF Document
Adobe Versioning Issue with Aspose PDF?
I'm wondering if there's a known issue with older versions of Adobe Reader behaving properly with the Aspose PDF dll?
The client I'm working with has Adobe Reader 10, for my testing I've been using Adobe Reader DC which is a newer version of the software. They've told me that some of their documents are opening very slowly (taking 2-4 mins to open) whereas others aren't opening at all.
When I test out one of the ones that's not opening at all on my machine, it opens up after a few seconds and fills in the merge field data for some of the fields (we also don't have all of the merge fields in place that they have, they have some that are specific to them).
Which leads me to believe that it's either a problem with with the way the merge field data is being handled for one of the fields I'm not filling in, or it's a matter of the older version of Adobe and Aspose not playing nice with each other.
My code is below:
'Do PDF merge
' Load XFA form
Dim doc As Aspose.Pdf.Document = New Aspose.Pdf.Document(sTemplateDir & sDocName)
' Get names of XFA form fields
Dim names As String() = doc.Form.XFA.FieldNames
'Get names of form fields
Dim fields As Aspose.Pdf.InteractiveFeatures.Forms.Field() = doc.Form.Fields
Dim sField As String
Dim field As Aspose.Pdf.InteractiveFeatures.Forms.Field
If fields.Length > 0 Then
For Each field In fields
'Get name of field
sField = field.FullName
'If the merge field isn't valid then we'll just leave it and assume its a fill-in
If nMergeCol.Contains(sField) And Not IsNothing(sField) Then
field.Value = nMergeCol.Item(sField)
End If
Next
Else
' Set field values
Dim sName As String
For Each sName In names
'Parse the XFA name
Dim sCount As Integer = sName.Length
Dim period As Integer = InStrRev(sName, ".")
Dim newName As String = sName.Substring(period)
Dim sMergeName As String = newName.Remove(newName.Length - 3, 3)
If nMergeCol.Contains(sMergeName) Then
doc.Form.XFA(sName) = nMergeCol.Item(sMergeName)
End If
Next
End If
On a side note, the XFA part of the code seems to be working fine from what the client has told me, the issue is just with the part that goes through the regular document fields.
Any assistance would be appreciated.
Thanks!
Issues with missing characters and font handling
If there is a character which is not contained by any installed font, the character will be replaced by a square. Also if a character doesn't exist for a specific font, but there is another font installed which does contain this character, this character is taken from this font.
For example if we create a PDF file using "Times New Roman" and add the text "Test". The PDF document will contain the text with the correct font. However if we add the text "Test テスト蟗", the fonts "MSGothic" and "ArialUnicodeMS" will be used instead (according to the document properties from Acrobat Reader).
We need a way to retrieve the following information when adding text to the document:
- Is there an unresolvable character in the text? (no font available)
- Are characters in the text which require a different font?
- Which fonts are required/used?
The minimal setup code ("Test" is obviously not Times):
static void test(String outfile)
{
Aspose.Pdf.Document doc = new Aspose.Pdf.Document();
Aspose.Pdf.Page page = doc.Pages.Add();
Aspose.Pdf.Text.TextFragment fragment = new Aspose.Pdf.Text.TextFragment("Test テスト 蟗");
fragment.TextState.Font = Aspose.Pdf.Text.FontRepository.FindFont("Times-New-Roman");
fragment.TextState.FontSize = 40;
Aspose.Pdf.Text.TextBuilder tb = new Aspose.Pdf.Text.TextBuilder(page);
tb.AppendText(fragment);
doc.Save(outfile);
}