Convert DOCX to PDF in Black and White (BW)

Hi,

is there a way to save the converted DOCX File to a PDF File in BW? Especially the Markups should be BW in the Output PDF.

thank you

Franz

Hi Franz,

Thanks for your request.

Unfortunately, there is no direct way to achieve this. However, you can convert your document to black and white tiff (TiffCompression.Ccitt3 or TiffCompression.Ccitt4) and then convert tiff to PDF. However, in this case you will not be able to select and copy text from PDF because all content will be represented as images. Here you can find a simple code example that shows how to convert tiff to PDF:
https://docs.aspose.com/words/net/convert-a-document-to-pdf/

We have also logged your requirement in our issue tracking system as WORDSNET-10516. Our development team will further look into the details of this requirement and we will keep you updated on the status. We apologize for any inconvenience.

Best regards,

Hi Franz,

Thanks for being patient. We need the following information about the requested feature:

  1. Only images should be converted to black and white or all document’s components including text font, vector graphic and so on should be rendered as black and white?
  2. Please share examples of source Word file and black and white output PDF file here for our reference.

Best regards,

Hi,

- source.docx is the Word input file.

- out.pdf is the current output with Markups from Aspose DLL File.

- and “would_be_great_sw.pdf” is the requested output pdf File.

thank you in advance.

Franz

Hi Franz,

Thanks for the additional information. We have passed your requirements to our development team and will inform you via this thread as soon as this issue is resolved.

Best regards,

Hi Franz,

We see that you are more concerned about color of mark-up (as far as we understand it is called revision in Aspose.Words). So, It’s color can be controlled through options RevisionOptions class as follows:

doc.LayoutOptions.RevisionOptions.DeletedTextColor = RevisionColor.Black;
doc.LayoutOptions.RevisionOptions.InsertedTextColor = RevisionColor.Black;
doc.LayoutOptions.RevisionOptions.RevisedPropertiesColor = RevisionColor.Black;
doc.LayoutOptions.RevisionOptions.RevisionBarsColor = RevisionColor.Black;

I’ve attached output generated with these options. Please let us know if it is good enough for you for the moment?

Best regards,

thank you for the Options. Yes it helps for the revisions.

Is there also a Option to Change the font Color to black for the whole document?

Hi Franz,

Thanks for your inquiry. Once the document is loaded into Aspose.Words’ DOM, you can use code like below to change the font color of the entire Word document:

Document doc = new Document(@"C:\Temp\input.doc");
FontChanger changer = new FontChanger();
doc.Accept(changer);
doc.Save(@"C:\Temp\out.pdf");

///
/// Class inherited from DocumentVisitor, that chnges font.
///
class FontChanger: DocumentVisitor
{
    ///

    /// Called when a FieldEnd node is encountered in the document.
    ///
    public override VisitorAction VisitFieldEnd(FieldEnd fieldEnd)
    {
        // Simply change font name
        ResetFont(fieldEnd.Font);
        return VisitorAction.Continue;
    }
    ///

    /// Called when a FieldSeparator node is encountered in the document.
    ///
    public override VisitorAction VisitFieldSeparator(FieldSeparator fieldSeparator)
    {
        ResetFont(fieldSeparator.Font);
        return VisitorAction.Continue;
    }
    ///

    /// Called when a FieldStart node is encountered in the document.
    ///
    public override VisitorAction VisitFieldStart(FieldStart fieldStart)
    {
        ResetFont(fieldStart.Font);
        return VisitorAction.Continue;
    }
    ///

    /// Called when a Footnote end is encountered in the document.
    ///
    public override VisitorAction VisitFootnoteEnd(Footnote footnote)
    {
        ResetFont(footnote.Font);
        return VisitorAction.Continue;
    }
    ///

    /// Called when a FormField node is encountered in the document.
    ///
    public override VisitorAction VisitFormField(FormField formField)
    {
        ResetFont(formField.Font);
        return VisitorAction.Continue;
    }
    ///

    /// Called when a Paragraph end is encountered in the document.
    ///
    public override VisitorAction VisitParagraphEnd(Paragraph paragraph)
    {
        ResetFont(paragraph.ParagraphBreakFont);
        return VisitorAction.Continue;
    }
    ///

    /// Called when a Run node is encountered in the document.
    ///
    public override VisitorAction VisitRun(Run run)
    {
        ResetFont(run.Font);
        return VisitorAction.Continue;
    }
    ///

    /// Called when a SpecialChar is encountered in the document.
    ///
    public override VisitorAction VisitSpecialChar(SpecialChar specialChar)
    {
        ResetFont(specialChar.Font);
        return VisitorAction.Continue;
    }
    private void ResetFont(Aspose.Words.Font font)
    {
        font.Color = System.Drawing.Color.Black;
    }
}

I hope, this helps.

Best regards,

The issues you have found earlier (filed as WORDSNET-10516) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(1)