本文整理汇总了C#中Document.Convert方法的典型用法代码示例。如果您正苦于以下问题:C# Document.Convert方法的具体用法?C# Document.Convert怎么用?C# Document.Convert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Document
的用法示例。
在下文中一共展示了Document.Convert方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdf_DocumentConversion();
//open document
Document pdfDocument = new Document(dataDir + "PDFToPDFA.pdf");
//Convert to PDF/A compliant document
//during conversion process, the validation is also performed
pdfDocument.Convert(dataDir + "log.xml", PdfFormat.PDF_A_1B, ConvertErrorAction.Delete);
//save output document
pdfDocument.Save(dataDir + "PDFToPDFA_out.pdf");
}
示例2: Main
public static void Main(string[] args)
{
// The path to the documents directory.
string dataDir = Path.GetFullPath("../../../Data/");
//open document
Document pdfDocument = new Document(dataDir + "input.pdf");
//Convert to PDF/A compliant document
//during conversion process, the validation is also performed
pdfDocument.Convert(dataDir + "log.xml", PdfFormat.PDF_A_1B, ConvertErrorAction.Delete);
//save output document
pdfDocument.Save(dataDir + "output.pdf");
}
示例3: Run
public static void Run()
{
// ExStart:PDFToPDFA3b
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdf_DocumentConversion();
// Open document
Document pdfDocument = new Document(dataDir + "input.pdf");
pdfDocument.Convert(new MemoryStream(), PdfFormat.PDF_A_3B, ConvertErrorAction.Delete);
dataDir = dataDir + "PDFToPDFA3b_out.pdf";
// Save output document
pdfDocument.Save(dataDir);
// ExEnd:PDFToPDFA3b
Console.WriteLine("\nPDF file converted to PDF/A-3B format.\nFile saved at " + dataDir);
}
示例4: Run
public static void Run()
{
// ExStart:PDFToPDFA
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdf_DocumentConversion();
// Open document
Document pdfDocument = new Document(dataDir + "PDFToPDFA.pdf");
// Convert to PDF/A compliant document
// During conversion process, the validation is also performed
pdfDocument.Convert(dataDir + "log.xml", PdfFormat.PDF_A_1B, ConvertErrorAction.Delete);
dataDir = dataDir + "PDFToPDFA_out.pdf";
// Save output document
pdfDocument.Save(dataDir);
// ExEnd:PDFToPDFA
Console.WriteLine("\nPDF file converted to PDF/A-1b compliant PDF.\nFile saved at " + dataDir);
}
示例5: Run
public static void Run()
{
// ExStart:AddAttachmentToPDFA
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdf_DocumentConversion();
// Instantiate Document instance to load existing file
Aspose.Pdf.Document doc = new Document(dataDir + "input.pdf");
// Setup new file to be added as attachment
FileSpecification fileSpecification = new FileSpecification(dataDir + "aspose-logo.jpg", "Large Image file");
// Add attachment to document's attachment collection
doc.EmbeddedFiles.Add(fileSpecification);
// Perform conversion to PDF/A_3a so attachment is included in resultnat file
doc.Convert(dataDir + "log.txt", Aspose.Pdf.PdfFormat.PDF_A_3A, ConvertErrorAction.Delete);
// Save resultant file
doc.Save(dataDir + "AddAttachmentToPDFA_out.pdf");
// ExEnd:AddAttachmentToPDFA
Console.WriteLine("\nAttachment added successfully to PDF/A file.\nFile saved at " + dataDir);
}
示例6: Run
public static void Run()
{
// ExStart:ReplaceMissingFonts
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdf_DocumentConversion();
Aspose.Pdf.Text.Font originalFont = null;
try
{
originalFont = FontRepository.FindFont("AgencyFB");
}
catch (Exception)
{
// Font is missing on destination machine
FontRepository.Substitutions.Add(new SimpleFontSubstitution("AgencyFB", "Arial"));
}
var fileNew = new FileInfo(dataDir + "newfile_out.pdf");
var pdf = new Document(dataDir + "input.pdf");
pdf.Convert( dataDir + "log.xml", PdfFormat.PDF_A_1B, ConvertErrorAction.Delete);
pdf.Save(fileNew.FullName);
// ExEnd:ReplaceMissingFonts
}