Skip to content

When a get textblock from a PDF vary depending on the operating system #840

Description

@fpisarello-dawa

Hi, i have some problem when i get TextArea from this code:

When i run this script in Windows 10 Platform - LinqPad:

using (var document = PdfDocument.Open(FACTURA_AFIP.pdf))
{
for (var i = 1; i <= document.NumberOfPages; i += 4)
{
	// For PDF coordinates the y-axis runs from the bottom of the page up
	var bottomLeft = new PdfPoint(479, 149);
	var topRight = new PdfPoint(559, 159);
	var square = new PdfRectangle(bottomLeft, topRight);
	var page = document.GetPage(i);
	var letters = page.Letters.Where(x => square.IntersectsWith(x.GlyphRectangle)).ToList();

	var wordsInRegion = DefaultWordExtractor.Instance.GetWords(letters);
	var textInRegion = string.Join(" ", wordsInRegion.Select(x => x.Text).ToList());
			
	textInRegion.Dump();
	
}
}

Result:
72515176735833

but the same Script in Linux Ubuntu 20.04 - dotnet-script:
N°: 72515176735833

Why do Windows and Linux show different results?

Upload the PDF file form more detail.
FACTURA_AFIP.pdf

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions