Skip to content

Commit 60e1031

Browse files
authored
Merge pull request #76 from FacturAPI/feat/preview-pdf
add previewPdf method to Invoices
2 parents 70fc7a9 + 1403852 commit 60e1031

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8-
## [4.9.1] 2025-07-21:
8+
## [4.10.0] 2025-09-04
9+
10+
### Added
11+
12+
- Add `invoices.previewPdf` method to generate a preview PDF of an invoice before stamping it.
13+
14+
## [4.9.1] 2025-07-21
915

1016
### Fixed
1117

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "facturapi",
3-
"version": "4.9.2",
3+
"version": "4.10.0",
44
"description": "Librería oficial de Facturapi. Crea CFDIs timbrados y enviados al SAT, XML y PDF",
55
"main": "dist/index.cjs.js",
66
"module": "dist/index.es.js",

src/resources/invoices.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,13 @@ export default class Invoices {
157157
copyToDraft(id: string): Promise<Invoice> {
158158
return this.client.post('/invoices/' + id + '/copy');
159159
}
160+
161+
/**
162+
* Previews an invoice PDF before stamping it
163+
* @param body Invoice data
164+
* @returns PDF file in a stream (Node.js) or Blob (browser)
165+
*/
166+
previewPdf(body: Record<string, any>): Promise<NodeJS.ReadableStream | Blob> {
167+
return this.client.post('/invoices/preview/pdf', { body });
168+
}
160169
}

0 commit comments

Comments
 (0)