PDF and RTF Document Formats: Technical Questions and Answers
Engineering reference covering Technical Questions and Answers on fixed-layout ISO 32000 PDF cross-reference tables and 7-bit RTF control-word streams, how each format works at the byte level, how our deterministic generator builds and verifies them, and how to test them in QA pipelines.
Format hubs covered on this reference page
Part 1: Binary signatures, headers and specification rules
- 1. How does PDF page count relate to byte size?
- Page count and byte size are independent: a 10-page text PDF in Helvetica weighs around 12 KB, whereas a single page with an uncompressed raster scan can exceed 15 MB.
- 2. What does the second line of a binary PDF file contain?
- Immediately after %PDF-1.4, line 2 contains a comment with four high-bit bytes (% followed by bytes above 0x80) so FTP clients and git filters detect the stream as binary rather than ASCII.
- 3. Why do fillable PDF forms use AcroForm dictionaries?
- An AcroForm dictionary in the document catalog maps interactive widget annotations (/Subtype /Widget) to field names (/T) and values (/V) without executing JavaScript.
- 4. How do password-protected PDFs encrypt streams?
- Standard security handlers add an /Encrypt dictionary to the trailer and derive an RC4 or AES key from the user and owner passwords to encrypt strings and stream bodies while leaving object numbers visible.
- 5. What leading byte signature or magic number identifies a PDF (.pdf) file at offset 0?
- When a binary inspector reads the start of a .pdf stream, it checks for 25 50 44 46 2D. In PDF files, this signature is part of numbered indirect objects (N 0 obj ... endobj), content streams compressed with FlateDecode, a byte-offset cross-reference table (xref), and a trailer dictionary ending with startxref and %%EOF.
- 6. Which IANA MIME media type should an HTTP server return in Content-Type for .pdf downloads?
- Standardized delivery of PDF uses application/pdf. If a server sends a generic type without X-Content-Type-Options: nosniff, browsers may misinterpret .pdf payloads.
- 7. How does the internal structure of a PDF (.pdf) file organize headers and payload data?
- Inside .pdf, data is arranged as numbered indirect objects (N 0 obj ... endobj), content streams compressed with FlateDecode, a byte-offset cross-reference table (xref), and a trailer dictionary ending with startxref and %%EOF. Parsers such as PDFium, Mozilla pdf.js, Poppler pdftotext, pypdf, qpdf, and MuPDF validate this layout before extracting application content.
- 8. What is the smallest valid byte size that the SampleTestFiles generator allows for .pdf?
- The minimum valid size for a generated PDF fixture on this site is 1,125 bytes (with a step increment of 1 byte), because a smaller buffer cannot hold the required .pdf header and trailer structures.
- 9. How does SampleTestFiles pad a .pdf file to reach an exact byte count like 10,240 bytes or 1,048,576 bytes?
- Instead of appending null bytes past the end of the file, our deterministic .pdf builder achieves exact byte targets by inserting syntactically valid % comment lines right before the cross-reference table so every byte offset in xref remains exact.
- 10. What happens when a .pdf transfer is cut off halfway through uploading or downloading?
- In PDF streams, cutting off the final 64 bytes removes the startxref pointer and %%EOF marker, forcing viewers to attempt a full linear object scan. Testing this behavior verifies that your ingestion worker returns a 400 or 422 validation error instead of crashing.
- 11. Which open-source libraries and desktop programs are commonly used to parse or inspect .pdf fixtures?
- Engineers typically validate and parse .pdf files using PDFium, Mozilla pdf.js, Poppler pdftotext, pypdf, qpdf, and MuPDF, each of which checks the specification rules defined by ISO 32000-1 (PDF 1.7) and ISO 32000-2 (PDF 2.0).
- 12. What are the primary software engineering and QA use cases for sample .pdf files?
- Teams use deterministic .pdf fixtures for document upload forms, invoice generators, text-extraction pipelines, and in-browser iframe previewers, ensuring both small 10 KB unit tests and large 100 MB stress tests behave predictably.
- 13. How does in-browser Web Worker generation work for .pdf files up to 32 MB?
- When you request a .pdf sample of 32 MB or less on /formats/pdf/, a background Web Worker runs our seeded generator off the main UI thread, builds the PDF blob in memory, verifies its SHA-256 hash via Web Crypto, and triggers a local download.
- 14. How does Service Worker streaming create 50 MB to 1 GB .pdf files without running out of browser RAM?
- For .pdf sizes above 32 MB on Chromium and Firefox, /sw.js intercepts the local /__gen/f/pdf/ request and emits 1 MB chunks through a ReadableStream directly to the browser download manager so the full file never resides in memory.
- 15. What is the published SHA-256 checksum for the 5kb (5,120-byte) .pdf sample file?
- The deterministic sample-pdf-5kb.pdf fixture (5,120 bytes) has the SHA-256 digest 065325468ac444eb3f0ee380a576aafda429c1ec26a2f46e6698a64e15ea0947. Every build produces those exact bytes.
- 16. What is the exact byte count and SHA-256 hash of sample-pdf-25kb.pdf?
- The file sample-pdf-25kb.pdf measures exactly 25,600 bytes and its SHA-256 checksum is 981650c26175c36383944f7401c4ca8d8cbabc4b70fff7c73658271458c4297f.
- 17. What is the exact byte length and SHA-256 digest of the 200kb .pdf fixture (sample-pdf-200kb.pdf)?
- The 200kb PDF fixture (sample-pdf-200kb.pdf) is 204,800 bytes long with SHA-256 hash fa1d406a4f5da1e60fff76b643e51a3c0b631ea27283dc6b317a618af9a5ba20.
- 18. How do I verify a downloaded .pdf sample on Linux, macOS, and Windows PowerShell?
- Run sha256sum sample-pdf-10kb.pdf on Linux, shasum -a 256 sample-pdf-10kb.pdf on macOS, or Get-FileHash sample-pdf-10kb.pdf -Algorithm SHA256 in Windows PowerShell, and compare the output against /formats/pdf/.
- 19. Why can a browser report the wrong file.type when a user selects a renamed .pdf file in an <input type='file'> control?
- Browsers populate File.type from the operating system extension mapping rather than reading the file's 25 50 44 46 2D signature. Dropping the file into /inspector/ or checking magic bytes on the backend prevents spoofed .pdf uploads.
- 20. How do I attach a sample .pdf file to an automated upload test in Playwright?
- Save the .pdf fixture from /formats/pdf/ into your test directory and call await page.locator('input[type="file"]').setInputFiles('fixtures/sample-pdf-10kb.pdf') before submitting the form.
- 21. How do I test .pdf file uploads in Cypress and Selenium WebDriver?
- In Cypress, run cy.get('input[type="file"]').selectFile('cypress/fixtures/sample-pdf-10kb.pdf'). In Selenium WebDriver, pass the absolute filesystem path of the .pdf sample to WebElement.sendKeys().
- 22. Does HTTP gzip or Brotli transfer compression shrink a .pdf file over the network?
- For PDF (Optional per stream (Flate, DCT, JBIG2 and others)), network compression effectiveness depends on whether the payload is already entropy-coded; text-based formats compress heavily with Brotli, while pre-compressed binary streams gain almost nothing and waste CPU.
- 23. What happens if an API gateway or middleware reads a binary .pdf upload as a UTF-8 string?
- Decoding binary .pdf bytes as UTF-8 replaces any byte sequence invalid in UTF-8 with the 3-byte replacement character EF BF BD (U+FFFD), permanently corrupting numbered indirect objects (N 0 obj ... endobj), content streams compressed with FlateDecode, a byte-offset cross-reference table (xref), and a trailer dictionary ending with startxref and %%EOF.
- 24. How does the in-browser preview on /sample-files/pdf/10kb/ display .pdf contents safely?
- When you click Preview file on a .pdf sample page, the file previewer generates or slices the local Blob in memory and renders text nodes or native media controls without executing untrusted markup.
- 25. Why are Safari and iOS browsers capped at a lower maximum in-memory size for .pdf than desktop Chrome or Firefox?
- WebKit on macOS and iOS does not hand streamed Service Worker responses to its download manager reliably, so the download controller assembles .pdf files in RAM within a safe device ceiling (64 MB on iOS, 256 MB on desktop Safari).
Part 2: Internal container layout, padding and byte structure
- 1. Do the sample .pdf files on SampleTestFiles contain any real personal data or third-party copyrighted material?
- No. Every .pdf file is synthesized deterministically by our own generator from mathematical patterns and invented records (using reserved example.com domains) under our CC0 public-domain licence (/licence/).
- 2. What specification or standard defines the .pdf format implemented by our generator?
- Our PDF generator follows ISO 32000-1 (PDF 1.7) and ISO 32000-2 (PDF 2.0), ensuring every header field and delimiter matches what PDFium, Mozilla pdf.js, Poppler pdftotext, pypdf, qpdf, and MuPDF expect.
- 3. How should a backend service store uploaded .pdf files in S3, object storage, or Google Cloud Storage?
- Validate the .pdf magic signature (25 50 44 46 2D) on the first chunk, generate a UUID storage key instead of trusting the user filename, set Content-Type to application/pdf, and store the SHA-256 hex digest in object metadata.
- 4. Which size presets of .pdf are best for testing nginx client_max_body_size and AWS API Gateway limits?
- Use the 1 MB and 2 MB .pdf presets on /formats/pdf/ to test nginx's default 1m client_max_body_size, and use the 10 MB and 15 MB .pdf presets to test AWS API Gateway's 10 MB payload boundary.
- 5. What does the PDF (.pdf) specification table record for 'Extension'?
- For .pdf files in the Documents category, the 'Extension' attribute is defined as: .pdf. Parsers rely on this property when validating PDF streams.
- 6. What does the PDF (.pdf) specification table record for 'MIME type'?
- For .pdf files in the Documents category, the 'MIME type' attribute is defined as: application/pdf. Parsers rely on this property when validating PDF streams.
- 7. What does the PDF (.pdf) specification table record for 'Standard'?
- For .pdf files in the Documents category, the 'Standard' attribute is defined as: ISO 32000-1 (PDF 1.7) and ISO 32000-2 (PDF 2.0). Parsers rely on this property when validating PDF streams.
- 8. What does the PDF (.pdf) specification table record for 'Structure'?
- For .pdf files in the Documents category, the 'Structure' attribute is defined as: Header, body objects, cross-reference table, trailer. Parsers rely on this property when validating PDF streams.
- 9. What does the PDF (.pdf) specification table record for 'Compression'?
- For .pdf files in the Documents category, the 'Compression' attribute is defined as: Optional per stream (Flate, DCT, JBIG2 and others). Parsers rely on this property when validating PDF streams.
- 10. What does the PDF (.pdf) specification table record for 'Can contain'?
- For .pdf files in the Documents category, the 'Can contain' attribute is defined as: Text, fonts, images, forms, JavaScript, attachments, encryption. Parsers rely on this property when validating PDF streams.
- 11. What is inside the 5kb PDF sample (sample-pdf-5kb.pdf) and what is its exact byte count?
- The 5kb .pdf fixture (sample-pdf-5kb.pdf) contains numbered indirect objects (N 0 obj ... endobj), content streams compressed with FlateDecode, a byte-offset cross-reference table (xref), and a trailer dictionary ending with startxref and %%EOF. Its exact length is 5,120 bytes (1 5kb binary units) and its verified SHA-256 checksum is 065325468ac444eb3f0ee380a576aafda429c1ec26a2f46e6698a64e15ea0947.
- 12. What is inside the 10kb PDF sample (sample-pdf-10kb.pdf) and what is its exact byte count?
- The 10kb .pdf fixture (sample-pdf-10kb.pdf) contains numbered indirect objects (N 0 obj ... endobj), content streams compressed with FlateDecode, a byte-offset cross-reference table (xref), and a trailer dictionary ending with startxref and %%EOF. Its exact length is 10,240 bytes (1 10kb binary units) and its verified SHA-256 checksum is 55e329b46c35eb939ef575591e6bafe9f1e97d5f7fcb1fca8bfba23cd76d0fb8.
- 13. What is inside the 25kb PDF sample (sample-pdf-25kb.pdf) and what is its exact byte count?
- The 25kb .pdf fixture (sample-pdf-25kb.pdf) contains numbered indirect objects (N 0 obj ... endobj), content streams compressed with FlateDecode, a byte-offset cross-reference table (xref), and a trailer dictionary ending with startxref and %%EOF. Its exact length is 25,600 bytes (1 25kb binary units) and its verified SHA-256 checksum is 981650c26175c36383944f7401c4ca8d8cbabc4b70fff7c73658271458c4297f.
- 14. What is inside the 50kb PDF sample (sample-pdf-50kb.pdf) and what is its exact byte count?
- The 50kb .pdf fixture (sample-pdf-50kb.pdf) contains numbered indirect objects (N 0 obj ... endobj), content streams compressed with FlateDecode, a byte-offset cross-reference table (xref), and a trailer dictionary ending with startxref and %%EOF. Its exact length is 51,200 bytes (1 50kb binary units) and its verified SHA-256 checksum is 49c968ed55fd7386083fb02d9b1e3763466cd9e646da3189dfea6ec00b4a77c7.
- 15. What is inside the 100kb PDF sample (sample-pdf-100kb.pdf) and what is its exact byte count?
- The 100kb .pdf fixture (sample-pdf-100kb.pdf) contains numbered indirect objects (N 0 obj ... endobj), content streams compressed with FlateDecode, a byte-offset cross-reference table (xref), and a trailer dictionary ending with startxref and %%EOF. Its exact length is 102,400 bytes (1 100kb binary units) and its verified SHA-256 checksum is 81f7a79e3e5330ce78ca68466275ef7a75228a71dc55d5b83690cc6a0d6990da.
- 16. What is inside the 200kb PDF sample (sample-pdf-200kb.pdf) and what is its exact byte count?
- The 200kb .pdf fixture (sample-pdf-200kb.pdf) contains numbered indirect objects (N 0 obj ... endobj), content streams compressed with FlateDecode, a byte-offset cross-reference table (xref), and a trailer dictionary ending with startxref and %%EOF. Its exact length is 204,800 bytes (1 200kb binary units) and its verified SHA-256 checksum is fa1d406a4f5da1e60fff76b643e51a3c0b631ea27283dc6b317a618af9a5ba20.
- 17. What is inside the 500kb PDF sample (sample-pdf-500kb.pdf) and what is its exact byte count?
- The 500kb .pdf fixture (sample-pdf-500kb.pdf) contains numbered indirect objects (N 0 obj ... endobj), content streams compressed with FlateDecode, a byte-offset cross-reference table (xref), and a trailer dictionary ending with startxref and %%EOF. Its exact length is 512,000 bytes (1 500kb binary units) and its verified SHA-256 checksum is ec40d4e4a6ef8003cf7a8d2794ba10524c2b8fde7e84aed73f66e41ae0a265cb.
- 18. What is inside the 1mb PDF sample (sample-pdf-1mb.pdf) and what is its exact byte count?
- The 1mb .pdf fixture (sample-pdf-1mb.pdf) contains numbered indirect objects (N 0 obj ... endobj), content streams compressed with FlateDecode, a byte-offset cross-reference table (xref), and a trailer dictionary ending with startxref and %%EOF. Its exact length is 1,048,576 bytes (1 1mb binary units) and its verified SHA-256 checksum is 85678799dd29fc7392f31d9cceb2b6f80858fc3c635c2a30d492c4bdc53b66b0.
- 19. What is inside the 2mb PDF sample (sample-pdf-2mb.pdf) and what is its exact byte count?
- The 2mb .pdf fixture (sample-pdf-2mb.pdf) contains numbered indirect objects (N 0 obj ... endobj), content streams compressed with FlateDecode, a byte-offset cross-reference table (xref), and a trailer dictionary ending with startxref and %%EOF. Its exact length is 2,097,152 bytes (1 2mb binary units) and its verified SHA-256 checksum is 6a6987c57395682d9830e6fcc8f92764f9efb5e5afcf627e87b25ed012087d45.
- 20. What is inside the 5mb PDF sample (sample-pdf-5mb.pdf) and what is its exact byte count?
- The 5mb .pdf fixture (sample-pdf-5mb.pdf) contains numbered indirect objects (N 0 obj ... endobj), content streams compressed with FlateDecode, a byte-offset cross-reference table (xref), and a trailer dictionary ending with startxref and %%EOF. Its exact length is 5,242,880 bytes (1 5mb binary units) and its verified SHA-256 checksum is 9838291bb1f366658c50047289cf5aa9bcc8a3e5ed20c89713f86069349a0f8e.
- 21. What is inside the 10mb PDF sample (sample-pdf-10mb.pdf) and what is its exact byte count?
- The 10mb .pdf fixture (sample-pdf-10mb.pdf) contains numbered indirect objects (N 0 obj ... endobj), content streams compressed with FlateDecode, a byte-offset cross-reference table (xref), and a trailer dictionary ending with startxref and %%EOF. Its exact length is 10,485,760 bytes (1 10mb binary units) and its verified SHA-256 checksum is 495a89c1d0d072228d387a68f8f8f570729c5215d05f018576a21c0d96f3b3bf.
- 22. What is inside the 20mb PDF sample (sample-pdf-20mb.pdf) and what is its exact byte count?
- The 20mb .pdf fixture (sample-pdf-20mb.pdf) contains numbered indirect objects (N 0 obj ... endobj), content streams compressed with FlateDecode, a byte-offset cross-reference table (xref), and a trailer dictionary ending with startxref and %%EOF. Its exact length is 20,971,520 bytes (1 20mb binary units) and its verified SHA-256 checksum is 26f5668345c90f0d891a8e6d12c193ad090eea6a1fc5cce027bf0195b43ade54.
- 23. What is inside the 3mb PDF sample (sample-pdf-3mb.pdf) and what is its exact byte count?
- The 3mb .pdf fixture (sample-pdf-3mb.pdf) contains numbered indirect objects (N 0 obj ... endobj), content streams compressed with FlateDecode, a byte-offset cross-reference table (xref), and a trailer dictionary ending with startxref and %%EOF. Its exact length is 3,145,728 bytes (1 3mb binary units) and its verified SHA-256 checksum is 7985f8137dc5b2888777e0b7e8f079455aecb6c71333395202ef4df95fbc2560.
- 24. What is inside the 15mb PDF sample (sample-pdf-15mb.pdf) and what is its exact byte count?
- The 15mb .pdf fixture (sample-pdf-15mb.pdf) contains numbered indirect objects (N 0 obj ... endobj), content streams compressed with FlateDecode, a byte-offset cross-reference table (xref), and a trailer dictionary ending with startxref and %%EOF. Its exact length is 15,728,640 bytes (1 15mb binary units) and its verified SHA-256 checksum is 604a6cc1f8bcad296d68804b9bd4bcc7f4f73e7ce8d0153b4be380c932800429.
- 25. What is inside the 25mb PDF sample (sample-pdf-25mb.pdf) and what is its exact byte count?
- The 25mb .pdf fixture (sample-pdf-25mb.pdf) contains numbered indirect objects (N 0 obj ... endobj), content streams compressed with FlateDecode, a byte-offset cross-reference table (xref), and a trailer dictionary ending with startxref and %%EOF. Its exact length is 26,214,400 bytes (1 25mb binary units) and its verified SHA-256 checksum is 57f0df0b9282145c258b62b4b8ed82c3111ddcc9cc248ecdc028b2c58259c342.
Part 3: In-browser generation, streaming and SHA-256 checksums
- 1. How does RTF represent non-ASCII Unicode characters?
- RTF remains 7-bit ASCII safe by escaping 16-bit signed Unicode code points with \uN? control words or hex bytes with \'hh sequences.
- 2. Why is RTF safer than legacy binary DOC for untrusted text exchange?
- Because RTF is plain human-readable control markup rather than an OLE2 binary filesystem, it does not contain VBA macro storage streams.
- 3. What leading byte signature or magic number identifies a RTF (.rtf) file at offset 0?
- When a binary inspector reads the start of a .rtf stream, it checks for 7B 5C 72 74 66 31. In RTF files, this signature is part of 7-bit ASCII control words starting with a backslash (\rtf1\ansi\deff0), nested curly-brace groups {...}, a \fonttbl font table, and paragraph formatting tokens (\pard, \par).
- 4. Which IANA MIME media type should an HTTP server return in Content-Type for .rtf downloads?
- Standardized delivery of RTF uses application/rtf. If a server sends a generic type without X-Content-Type-Options: nosniff, browsers may misinterpret .rtf payloads.
- 5. How does the internal structure of a RTF (.rtf) file organize headers and payload data?
- Inside .rtf, data is arranged as 7-bit ASCII control words starting with a backslash (\rtf1\ansi\deff0), nested curly-brace groups {...}, a \fonttbl font table, and paragraph formatting tokens (\pard, \par). Parsers such as LibreOffice Writer, Microsoft Word, unrtf, Pandoc, and macOS TextEdit validate this layout before extracting application content.
- 6. What is the smallest valid byte size that the SampleTestFiles generator allows for .rtf?
- The minimum valid size for a generated RTF fixture on this site is 150 bytes (with a step increment of 1 byte), because a smaller buffer cannot hold the required .rtf header and trailer structures.
- 7. How does SampleTestFiles pad a .rtf file to reach an exact byte count like 10,240 bytes or 1,048,576 bytes?
- Instead of appending null bytes past the end of the file, our deterministic .rtf builder achieves exact byte targets by extending deterministic prose paragraphs and \par blocks inside the main document group before the final closing brace }.
- 8. What happens when a .rtf transfer is cut off halfway through uploading or downloading?
- In RTF streams, dropping the final closing curly brace } leaves the root \rtf1 group unclosed, causing strict RTF readers to report an unexpected end of file. Testing this behavior verifies that your ingestion worker returns a 400 or 422 validation error instead of crashing.
- 9. Which open-source libraries and desktop programs are commonly used to parse or inspect .rtf fixtures?
- Engineers typically validate and parse .rtf files using LibreOffice Writer, Microsoft Word, unrtf, Pandoc, and macOS TextEdit, each of which checks the specification rules defined by Documents.
- 10. What are the primary software engineering and QA use cases for sample .rtf files?
- Teams use deterministic .rtf fixtures for cross-platform rich-text editors, legacy word-processor migration, and email client rich-text body rendering, ensuring both small 10 KB unit tests and large 100 MB stress tests behave predictably.
- 11. How does in-browser Web Worker generation work for .rtf files up to 32 MB?
- When you request a .rtf sample of 32 MB or less on /formats/rtf/, a background Web Worker runs our seeded generator off the main UI thread, builds the RTF blob in memory, verifies its SHA-256 hash via Web Crypto, and triggers a local download.
- 12. How does Service Worker streaming create 50 MB to 1 GB .rtf files without running out of browser RAM?
- For .rtf sizes above 32 MB on Chromium and Firefox, /sw.js intercepts the local /__gen/f/rtf/ request and emits 1 MB chunks through a ReadableStream directly to the browser download manager so the full file never resides in memory.
- 13. What is the published SHA-256 checksum for the 1kb (1,024-byte) .rtf sample file?
- The deterministic sample-rtf-1kb.rtf fixture (1,024 bytes) has the SHA-256 digest 7359e23a983cc8febfefca09cbf2702978dc64a0c6d254c425394a71fe119481. Every build produces those exact bytes.
- 14. What is the exact byte count and SHA-256 hash of sample-rtf-100kb.rtf?
- The file sample-rtf-100kb.rtf measures exactly 102,400 bytes and its SHA-256 checksum is b8c9576e3a3761abf050e48ba483da38af5c2fa5ae87bbc3f403768d10646474.
- 15. What is the exact byte length and SHA-256 digest of the 25kb .rtf fixture (sample-rtf-25kb.rtf)?
- The 25kb RTF fixture (sample-rtf-25kb.rtf) is 25,600 bytes long with SHA-256 hash ec7063416b300f34ba0bb3067df9dfa1f25df3a1125d043a4c0045cf5ff9c225.
- 16. How do I verify a downloaded .rtf sample on Linux, macOS, and Windows PowerShell?
- Run sha256sum sample-rtf-10kb.rtf on Linux, shasum -a 256 sample-rtf-10kb.rtf on macOS, or Get-FileHash sample-rtf-10kb.rtf -Algorithm SHA256 in Windows PowerShell, and compare the output against /formats/rtf/.
- 17. Why can a browser report the wrong file.type when a user selects a renamed .rtf file in an <input type='file'> control?
- Browsers populate File.type from the operating system extension mapping rather than reading the file's 7B 5C 72 74 66 31 signature. Dropping the file into /inspector/ or checking magic bytes on the backend prevents spoofed .rtf uploads.
- 18. How do I attach a sample .rtf file to an automated upload test in Playwright?
- Save the .rtf fixture from /formats/rtf/ into your test directory and call await page.locator('input[type="file"]').setInputFiles('fixtures/sample-rtf-10kb.rtf') before submitting the form.
- 19. How do I test .rtf file uploads in Cypress and Selenium WebDriver?
- In Cypress, run cy.get('input[type="file"]').selectFile('cypress/fixtures/sample-rtf-10kb.rtf'). In Selenium WebDriver, pass the absolute filesystem path of the .rtf sample to WebElement.sendKeys().
- 20. Does HTTP gzip or Brotli transfer compression shrink a .rtf file over the network?
- For RTF (structured data), network compression effectiveness depends on whether the payload is already entropy-coded; text-based formats compress heavily with Brotli, while pre-compressed binary streams gain almost nothing and waste CPU.
- 21. What happens if an API gateway or middleware reads a binary .rtf upload as a UTF-8 string?
- Decoding binary .rtf bytes as UTF-8 replaces any byte sequence invalid in UTF-8 with the 3-byte replacement character EF BF BD (U+FFFD), permanently corrupting 7-bit ASCII control words starting with a backslash (\rtf1\ansi\deff0), nested curly-brace groups {...}, a \fonttbl font table, and paragraph formatting tokens (\pard, \par).
- 22. How does the in-browser preview on /sample-files/rtf/10kb/ display .rtf contents safely?
- When you click Preview file on a .rtf sample page, the file previewer generates or slices the local Blob in memory and renders text nodes or native media controls without executing untrusted markup.
- 23. Why are Safari and iOS browsers capped at a lower maximum in-memory size for .rtf than desktop Chrome or Firefox?
- WebKit on macOS and iOS does not hand streamed Service Worker responses to its download manager reliably, so the download controller assembles .rtf files in RAM within a safe device ceiling (64 MB on iOS, 256 MB on desktop Safari).
- 24. Do the sample .rtf files on SampleTestFiles contain any real personal data or third-party copyrighted material?
- No. Every .rtf file is synthesized deterministically by our own generator from mathematical patterns and invented records (using reserved example.com domains) under our CC0 public-domain licence (/licence/).
- 25. What specification or standard defines the .rtf format implemented by our generator?
- Our RTF generator follows the published RTF specification, ensuring every header field and delimiter matches what LibreOffice Writer, Microsoft Word, unrtf, Pandoc, and macOS TextEdit expect.
Part 4: Parser libraries, edge cases and automated QA testing
- 1. How should a backend service store uploaded .rtf files in S3, object storage, or Google Cloud Storage?
- Validate the .rtf magic signature (7B 5C 72 74 66 31) on the first chunk, generate a UUID storage key instead of trusting the user filename, set Content-Type to application/rtf, and store the SHA-256 hex digest in object metadata.
- 2. Which size presets of .rtf are best for testing nginx client_max_body_size and AWS API Gateway limits?
- Use the 1 MB and 2 MB .rtf presets on /formats/rtf/ to test nginx's default 1m client_max_body_size, and use the 10 MB and 15 MB .rtf presets to test AWS API Gateway's 10 MB payload boundary.
- 3. What does the RTF (.rtf) specification table record for 'Extension'?
- For .rtf files in the Documents category, the 'Extension' attribute is defined as: .rtf. Parsers rely on this property when validating RTF streams.
- 4. What does the RTF (.rtf) specification table record for 'MIME type'?
- For .rtf files in the Documents category, the 'MIME type' attribute is defined as: application/rtf. Parsers rely on this property when validating RTF streams.
- 5. What does the RTF (.rtf) specification table record for 'Also seen as'?
- For .rtf files in the Documents category, the 'Also seen as' attribute is defined as: text/rtf. Parsers rely on this property when validating RTF streams.
- 6. What does the RTF (.rtf) specification table record for 'Latest version'?
- For .rtf files in the Documents category, the 'Latest version' attribute is defined as: 1.9.1 (2008). Parsers rely on this property when validating RTF streams.
- 7. What does the RTF (.rtf) specification table record for 'Encoding'?
- For .rtf files in the Documents category, the 'Encoding' attribute is defined as: 7-bit ASCII with escapes for other characters. Parsers rely on this property when validating RTF streams.
- 8. What does the RTF (.rtf) specification table record for 'Structure'?
- For .rtf files in the Documents category, the 'Structure' attribute is defined as: Nested groups in braces with control words. Parsers rely on this property when validating RTF streams.
- 9. What does the RTF (.rtf) specification table record for 'Can contain'?
- For .rtf files in the Documents category, the 'Can contain' attribute is defined as: Formatted text, tables, images, embedded objects. Parsers rely on this property when validating RTF streams.
- 10. What is inside the 1kb RTF sample (sample-rtf-1kb.rtf) and what is its exact byte count?
- The 1kb .rtf fixture (sample-rtf-1kb.rtf) contains 7-bit ASCII control words starting with a backslash (\rtf1\ansi\deff0), nested curly-brace groups {...}, a \fonttbl font table, and paragraph formatting tokens (\pard, \par). Its exact length is 1,024 bytes (1 1kb binary units) and its verified SHA-256 checksum is 7359e23a983cc8febfefca09cbf2702978dc64a0c6d254c425394a71fe119481.
- 11. What is inside the 10kb RTF sample (sample-rtf-10kb.rtf) and what is its exact byte count?
- The 10kb .rtf fixture (sample-rtf-10kb.rtf) contains 7-bit ASCII control words starting with a backslash (\rtf1\ansi\deff0), nested curly-brace groups {...}, a \fonttbl font table, and paragraph formatting tokens (\pard, \par). Its exact length is 10,240 bytes (1 10kb binary units) and its verified SHA-256 checksum is 596bc7e350ef6d08bfca0aacb9ac5e7e217fa323802bc0b0e3273762a29a4ff7.
- 12. What is inside the 100kb RTF sample (sample-rtf-100kb.rtf) and what is its exact byte count?
- The 100kb .rtf fixture (sample-rtf-100kb.rtf) contains 7-bit ASCII control words starting with a backslash (\rtf1\ansi\deff0), nested curly-brace groups {...}, a \fonttbl font table, and paragraph formatting tokens (\pard, \par). Its exact length is 102,400 bytes (1 100kb binary units) and its verified SHA-256 checksum is b8c9576e3a3761abf050e48ba483da38af5c2fa5ae87bbc3f403768d10646474.
- 13. What is inside the 1mb RTF sample (sample-rtf-1mb.rtf) and what is its exact byte count?
- The 1mb .rtf fixture (sample-rtf-1mb.rtf) contains 7-bit ASCII control words starting with a backslash (\rtf1\ansi\deff0), nested curly-brace groups {...}, a \fonttbl font table, and paragraph formatting tokens (\pard, \par). Its exact length is 1,048,576 bytes (1 1mb binary units) and its verified SHA-256 checksum is 6e54b6dc64ee0129262659aedc83ab89e0869652bdc994130d1414a6cb7f49b1.
- 14. What is inside the 5kb RTF sample (sample-rtf-5kb.rtf) and what is its exact byte count?
- The 5kb .rtf fixture (sample-rtf-5kb.rtf) contains 7-bit ASCII control words starting with a backslash (\rtf1\ansi\deff0), nested curly-brace groups {...}, a \fonttbl font table, and paragraph formatting tokens (\pard, \par). Its exact length is 5,120 bytes (1 5kb binary units) and its verified SHA-256 checksum is 08165af92fcc5cdd4067c375b43bdc4114738dc66960d819084f875032c1c0bb.
- 15. What is inside the 25kb RTF sample (sample-rtf-25kb.rtf) and what is its exact byte count?
- The 25kb .rtf fixture (sample-rtf-25kb.rtf) contains 7-bit ASCII control words starting with a backslash (\rtf1\ansi\deff0), nested curly-brace groups {...}, a \fonttbl font table, and paragraph formatting tokens (\pard, \par). Its exact length is 25,600 bytes (1 25kb binary units) and its verified SHA-256 checksum is ec7063416b300f34ba0bb3067df9dfa1f25df3a1125d043a4c0045cf5ff9c225.
- 16. What is inside the 50kb RTF sample (sample-rtf-50kb.rtf) and what is its exact byte count?
- The 50kb .rtf fixture (sample-rtf-50kb.rtf) contains 7-bit ASCII control words starting with a backslash (\rtf1\ansi\deff0), nested curly-brace groups {...}, a \fonttbl font table, and paragraph formatting tokens (\pard, \par). Its exact length is 51,200 bytes (1 50kb binary units) and its verified SHA-256 checksum is 5ef93b46351d7dc63176bfab372b6e2532738f64118888aef97d34ca2d0e93a7.
- 17. What is inside the 200kb RTF sample (sample-rtf-200kb.rtf) and what is its exact byte count?
- The 200kb .rtf fixture (sample-rtf-200kb.rtf) contains 7-bit ASCII control words starting with a backslash (\rtf1\ansi\deff0), nested curly-brace groups {...}, a \fonttbl font table, and paragraph formatting tokens (\pard, \par). Its exact length is 204,800 bytes (1 200kb binary units) and its verified SHA-256 checksum is 93adad3f6567e4157babe36bd4537d048e2326c4edd159b3df324746683c6065.
- 18. What is inside the 500kb RTF sample (sample-rtf-500kb.rtf) and what is its exact byte count?
- The 500kb .rtf fixture (sample-rtf-500kb.rtf) contains 7-bit ASCII control words starting with a backslash (\rtf1\ansi\deff0), nested curly-brace groups {...}, a \fonttbl font table, and paragraph formatting tokens (\pard, \par). Its exact length is 512,000 bytes (1 500kb binary units) and its verified SHA-256 checksum is d04b0a49f15ea527613b8778a1b62cd5f76ddbde7a8c89829e8b99c44edaaef2.
- 19. What is inside the 2mb RTF sample (sample-rtf-2mb.rtf) and what is its exact byte count?
- The 2mb .rtf fixture (sample-rtf-2mb.rtf) contains 7-bit ASCII control words starting with a backslash (\rtf1\ansi\deff0), nested curly-brace groups {...}, a \fonttbl font table, and paragraph formatting tokens (\pard, \par). Its exact length is 2,097,152 bytes (1 2mb binary units) and its verified SHA-256 checksum is 8364ddbece57bc46d0d974f0bba3299f99091f5727d9401c22f21fdc165730a4.
- 20. What is inside the 3mb RTF sample (sample-rtf-3mb.rtf) and what is its exact byte count?
- The 3mb .rtf fixture (sample-rtf-3mb.rtf) contains 7-bit ASCII control words starting with a backslash (\rtf1\ansi\deff0), nested curly-brace groups {...}, a \fonttbl font table, and paragraph formatting tokens (\pard, \par). Its exact length is 3,145,728 bytes (1 3mb binary units) and its verified SHA-256 checksum is 6c3251ef88c80d1f8ad6bf0c245873cf89c516ad76491a75c599270309649278.
- 21. What is inside the 5mb RTF sample (sample-rtf-5mb.rtf) and what is its exact byte count?
- The 5mb .rtf fixture (sample-rtf-5mb.rtf) contains 7-bit ASCII control words starting with a backslash (\rtf1\ansi\deff0), nested curly-brace groups {...}, a \fonttbl font table, and paragraph formatting tokens (\pard, \par). Its exact length is 5,242,880 bytes (1 5mb binary units) and its verified SHA-256 checksum is de46e9b0df540df9f268ba3cfdb3015e75d8387668760486a8dbe371654a8023.
- 22. What is inside the 10mb RTF sample (sample-rtf-10mb.rtf) and what is its exact byte count?
- The 10mb .rtf fixture (sample-rtf-10mb.rtf) contains 7-bit ASCII control words starting with a backslash (\rtf1\ansi\deff0), nested curly-brace groups {...}, a \fonttbl font table, and paragraph formatting tokens (\pard, \par). Its exact length is 10,485,760 bytes (1 10mb binary units) and its verified SHA-256 checksum is 273054f1571da3eccac58feb91f81c7cd63e105cda86e6e3e3e3cda149a25542.
- 23. What is inside the 15mb RTF sample (sample-rtf-15mb.rtf) and what is its exact byte count?
- The 15mb .rtf fixture (sample-rtf-15mb.rtf) contains 7-bit ASCII control words starting with a backslash (\rtf1\ansi\deff0), nested curly-brace groups {...}, a \fonttbl font table, and paragraph formatting tokens (\pard, \par). Its exact length is 15,728,640 bytes (1 15mb binary units) and its verified SHA-256 checksum is 17bf81e62a00b26220141f47fb489c40aadc62722647cd1caf0d190733b48cfa.
- 24. What is inside the 20mb RTF sample (sample-rtf-20mb.rtf) and what is its exact byte count?
- The 20mb .rtf fixture (sample-rtf-20mb.rtf) contains 7-bit ASCII control words starting with a backslash (\rtf1\ansi\deff0), nested curly-brace groups {...}, a \fonttbl font table, and paragraph formatting tokens (\pard, \par). Its exact length is 20,971,520 bytes (1 20mb binary units) and its verified SHA-256 checksum is d0b3d1d2fc387cfa803721d46d75a2835c15716b56f3619164a687503dc4a914.
- 25. What is inside the 25mb RTF sample (sample-rtf-25mb.rtf) and what is its exact byte count?
- The 25mb .rtf fixture (sample-rtf-25mb.rtf) contains 7-bit ASCII control words starting with a backslash (\rtf1\ansi\deff0), nested curly-brace groups {...}, a \fonttbl font table, and paragraph formatting tokens (\pard, \par). Its exact length is 26,214,400 bytes (1 25mb binary units) and its verified SHA-256 checksum is d6c6387995e1655f81ec7e0689267261fe3ce299ee812dcc867533b588952b79.
Explore more topic-based technical format references
Browse all 20 deep-dive Q&A guides on Testing guides or Frequently asked questions.