Save PDF as TIFF image using Aspose.PDF for .NET - PDF becomes blurry

I have a PDF that I’ve created in Aspose.PDF and I want to save it as an image. When trying to save as a TIFF, the PDF becomes blurry. I’m also losing some of the lines that I’m adding to the PDF.

If I save as PDF it looks like this:
test3.pdf (15.7 KB)

If I save as a TIFF it looks like this (attaching a screenshot because this system will not allow me to upload a TIFF) Notice how the bars become blurry:
2020-07-20_14-05-52.png (109.4 KB)

Source code:
Private Sub ButtonSupport_Click(sender As Object, e As EventArgs)

    Dim bArr() As Byte
    Dim License As Aspose.BarCode.License = New Aspose.BarCode.License()
    License.SetLicense("C:\Users\nbart\Documents\SourceCode\psg-docutransfer\ConnectSuite\Aspose\Aspose.Library\bin\Aspose.Barcode.lic")
    Dim Generator = New Aspose.BarCode.Generation.BarcodeGenerator(EncodeTypes.GS1Code128, "(420)55350(92)14890194038316398145")

    Aspose.Library.PdfHelper.LoadLic()

    Generator.Parameters.Barcode.BarHeight.Point = 39
    Generator.Parameters.Barcode.AutoSizeMode = Generation.AutoSizeMode.None
    Generator.Parameters.Barcode.XDimension.Point = 1
    Generator.Parameters.Barcode.CodeTextParameters.Location = CodeLocation.None
    Generator.Parameters.Barcode.CodeTextParameters.Alignment = Aspose.BarCode.Generation.TextAlignment.Center
    Generator.Parameters.CaptionBelow.Visible = True
    Generator.Parameters.Barcode.Padding.Bottom.Point = 6
    Generator.Parameters.Barcode.Padding.Top.Point = 6

    Generator.Parameters.CaptionBelow.Text = "9214 8901 1538 5200 5203 11"
    Generator.Parameters.CaptionBelow.Font.FamilyName = Font.Bold

    Generator.Parameters.CaptionAbove.Text = "USPS CERTIFIED MAIL"
    Generator.Parameters.CaptionAbove.Visible = True


    Dim lGeneratedBitmap = Generator.GenerateBarCodeImage()
    Dim imageWidth = lGeneratedBitmap.Width
    Dim imageLength = lGeneratedBitmap.Height
    Dim mStream = New System.IO.MemoryStream()

    Generator.Save(mStream, Aspose.BarCode.BarCodeImageFormat.Bmp)

    Dim ImageStamp = New ImageStamp(mStream)
    ImageStamp.Background = True
    ImageStamp.XIndent = 18
    ImageStamp.YIndent = 0
    ImageStamp.Quality = 100

    Dim pdfDocument = New Document()

    Dim Page = pdfDocument.Pages.Add()
    pdfDocument.Pages(1).SetPageSize(imageWidth + 36, 108)
    Page.PageInfo.Margin = New MarginInfo(0, 0, 0, 0)
    Page.AddStamp(ImageStamp)

    Dim graph = New Aspose.Pdf.Drawing.Graph(Page.PageInfo.Width, Page.PageInfo.Height)

    Dim line = New Aspose.Pdf.Drawing.Line(New Single() {1, 106, (imageWidth - 1) + 36, 106})
    line.GraphInfo.LineWidth = 2
    graph.Shapes.Add(line)

    Dim line2 = New Aspose.Pdf.Drawing.Line(New Single() {1, 2, (imageWidth - 1) + 36, 2})
    line2.GraphInfo.LineWidth = 2
    graph.Shapes.Add(line2)
    Page.Paragraphs.Add(graph)

    Dim pdfConverter = New PdfConverter()
    pdfConverter.BindPdf(pdfDocument)
    pdfConverter.DoConvert()
    pdfConverter.SaveAsTIFF("C:\Users\nbart\Downloads\test3.tif")
    pdfConverter.Close()

End Sub

@nathanbartell

We used following recommended DOM based code snippet to generate TIFF from the PDF file that you shared and were able to notice the issue in output image. We have logged and issue as PDFNET-48567 in our issue tracking system for it. We will look into its details and keep you posted with the status of its rectification. Please be patient and spare us some time.

Document document = new Document(dataDir + "test3.pdf");
Resolution resolution = new Resolution(300);
// Create TiffSettings object
TiffSettings tiffSettings = new TiffSettings()
{
 Compression = CompressionType.LZW,
 //Depth = ColorDepth.Format8bpp
};
// Create TIFF device
TiffDevice tiffDevice = new TiffDevice(resolution, tiffSettings)
{
 RenderingOptions = new RenderingOptions
 {
  SystemFontsNativeRendering = true,
  UseNewImagingEngine = true
 }
};

// Convert a particular page and save the image to stream
tiffDevice.Process(document, dataDir + "Test3.tiff");

We are sorry for the inconvenience.

Hi Asad!

I just wanted to check in with you to see if there has been any progress made on this.

Thank you, Asad!

@nathanbartell

The issue has recently been logged in our issue tracking system and currently is pending for investigation. It will be resolved on first come first serve basis. We will surely inform you as soon as we have some definite updates regarding its resolution. Please be patient and spare us little time.

@asad.ali Thanks. Can you give me a rough estimate of time? A couple of weeks? A couple of months? A year?

Thanks, @asad.ali.

@nathanbartell

We are afraid that we cannot share any ETA before issue is fully investigated. The resolution time of the issue may depend upon its complexity and number of the issues logged prior to it. It could take some weeks or months depending upon the factors we mentioned. We will inform you once it is fully analysed and we have some news about ETA or its fix. We highly appreciate your patience in this regard.

We are sorry for the inconvenience.

@asad.ali Thank you for your transparency! I think my project can wait until Aspose has a solution.

Thanks again.

@nathanbartell

Thanks for understanding our position. We will surely inform you as soon as the issue is resolved.