Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RangeError (byteOffset): Index out of range: index should be less than 81487: 81496 #1753

Open
sutariyaharsh opened this issue Oct 1, 2024 · 0 comments
Labels
bug Something isn't working needs triage

Comments

@sutariyaharsh
Copy link

RangeError in PDF generation when using certain PdfGoogleFonts

I am encountering an issue while generating a PDF using the pdf and printing packages in Flutter. The error specifically occurs when using some of the PdfGoogleFonts. Below is the error log that is thrown during PDF generation.

======== Exception caught by printing ==============================================
The following IndexError was thrown while generating a PDF:
RangeError (byteOffset): Index out of range: index should be less than 81487: 81496

When the exception was thrown, this was the stack:
#0 _byteDataByteOffsetCheck (dart:typed_data-patch/typed_data_patch.dart:5102:5)
#1 _ByteDataView.getUint16 (dart:typed_data-patch/typed_data_patch.dart:4880:18)
#2 TtfParser._readSimpleGlyph (package:pdf/src/pdf/font/ttf_parser.dart:466:21)
#3 TtfParser.readGlyph (package:pdf/src/pdf/font/ttf_parser.dart:446:14)
#4 TtfWriter.withChars.addGlyph (package:pdf/src/pdf/font/ttf_writer.dart:94:27)
#5 TtfWriter.withChars (package:pdf/src/pdf/font/ttf_writer.dart:104:7)
#6 PdfTtfFont._buildType0 (package:pdf/src/pdf/obj/ttffont.dart:121:28)
#7 PdfTtfFont.prepare (package:pdf/src/pdf/obj/ttffont.dart:162:7)
#8 PdfDocument._write (package:pdf/src/pdf/document.dart:225:10)
#9 PdfDocument.save. (package:pdf/src/pdf/document.dart:259:13)
#10 _RemoteRunner._run (dart:isolate:1090:47)
#11 _RemoteRunner._remoteExecute (dart:isolate:1084:12)
#12 _delayEntrypointInvocation. (dart:isolate-patch/isolate_patch.dart:300:17)
#13 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
PageFormat: "PdfPageFormat 595.275590551181x841.8897637795275 margins:56.69291338582677, 56.69291338582677, 56.69291338582677, 56.69291338582677"

dependencies:
  flutter:
    sdk: flutter
  pdf: ^3.11.1
  printing: ^5.13.3
  // Custom fonts
  final font = await PdfGoogleFonts.caveatMedium();
  final font2 = await PdfGoogleFonts.dancingScriptMedium();
  final font3 = await PdfGoogleFonts.novaMonoRegular();
@sutariyaharsh sutariyaharsh added bug Something isn't working needs triage labels Oct 1, 2024
Repository owner deleted a comment Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

1 participant