Aspose words to pdf

I am using the evaluation version aspose words to generate letters based on data from datasouce. When generating pdf using aspose words based on the data from data source I have the following questions with formating the data. I using a template to generate the output.

  1. How to set font style for data elements. 2. When using bullets for each record text the space between each record is big so how to reduce the space between each line. 3. Since words to pdf is rendering to pdf , is it in correct pdf format ?
    Below is the example for font style
    RE: Maria Hernandez Facility Unique ID#:1857

Hi,

Thanks for your inquiry.

*mpolk:

  1. How to set font style for data elements.*

The data elements use the same font style which mail merge field have in template document. E.g If a mail merge field has style “Title”, the data elements will have same “Title” style in output document.
However, you can change the font setting of each data element while using mail merge. You can use MailMerge.FieldMergingCallback to achieve this requirements. Please see the following code snippet.

private class FontChanger : IFieldMergingCallback
{
    void IFieldMergingCallback.FieldMerging(FieldMergingArgs args)
    {
        if (args.FieldName == "myField")
        {
            DocumentBuilder builder = new DocumentBuilder(args.Document);
            builder.MoveToMergeField(args.DocumentFieldName);
            builder.ParagraphFormat.ClearFormatting();
            builder.Font.Name = "Tahoma";
            builder.Write(args.FieldValue.ToString());
            builder.ParagraphFormat.ClearFormatting();
            args.Text = "";
        }
    }
    void IFieldMergingCallback.ImageFieldMerging(ImageFieldMergingArgs e)
    {
    }
}

mpolk:
2. When using bullets for each record text the space between each record is big so how to reduce the space between each line.

Please set the paragraph’s space after and before values in your template document. You can set it by using Aspose.Words with ParagraphFormat.SpaceAfter/SpaceBefore properties.

// Set paragraph formatting properties
ParagraphFormat paragraphFormat = builder.ParagraphFormat;
paragraphFormat.SpaceBefore = 0;
paragraphFormat.SpaceAfter = 0;

mpolk:
. Since words to pdf is rendering to pdf , is it in correct pdf format ?

Any document loaded into Aspose.Words can be converted to PDF that conforms to the PDF 1.5 or PDF/A-1b specification. Support for PDF/A-1a specification is planned. Aspose.Words provides one of the highest fidelity Word document to PDF conversion around. Many document features are exported to PDF exactly as how they appear in the original document.

Please read the following documentation link for your kind reference.
https://docs.aspose.com/words/net/convert-a-document-to-pdf/