You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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"
// Custom fonts
final font = await PdfGoogleFonts.caveatMedium();
final font2 = await PdfGoogleFonts.dancingScriptMedium();
final font3 = await PdfGoogleFonts.novaMonoRegular();
The text was updated successfully, but these errors were encountered:
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"
The text was updated successfully, but these errors were encountered: