Skip to content

Commit 0d7ac41

Browse files
authored
Merge pull request #37 from FacturAPI/feat/pdf-preview
2 parents 8dbfc14 + c23215f commit 0d7ac41

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

CHANGELOG.md

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

8+
## [4.10.0] - 2025-09-04
9+
10+
### Added
11+
12+
- Add `Invoices.PreviewPdfAsync` method to preview invoice PDF before stamping.
13+
814
## [4.9.1] - 2025-07-21
915

1016
### Fixed

Router/InvoiceRouter.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,10 @@ public static string CopyInvoice(string id)
6262
{
6363
return $"invoices/{id}/copy";
6464
}
65+
66+
public static string PreviewPdf(Dictionary<string, object> query = null)
67+
{
68+
return UriWithQuery("invoices/preview/pdf", query);
69+
}
6570
}
6671
}

Wrappers/InvoiceWrapper.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,5 +183,18 @@ public async Task<Invoice> CopyToDraftAsync(string id)
183183
var invoice = JsonConvert.DeserializeObject<Invoice>(resultString, this.jsonSettings);
184184
return invoice;
185185
}
186+
187+
public async Task<Stream> PreviewPdfAsync(Dictionary<string, object> query = null)
188+
{
189+
var response = await client.GetAsync(Router.PreviewPdf(query));
190+
if (!response.IsSuccessStatusCode)
191+
{
192+
var resultString = await response.Content.ReadAsStringAsync();
193+
var error = JsonConvert.DeserializeObject<JObject>(resultString, this.jsonSettings);
194+
throw new FacturapiException(error["message"].ToString());
195+
}
196+
var stream = await response.Content.ReadAsStreamAsync();
197+
return stream;
198+
}
186199
}
187200
}

facturapi-net.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
API Keys creando una cuenta gratuita en https://www.facturapi.io</Summary>
1212
<PackageTags>factura factura-electronica cfdi facturapi mexico conekta</PackageTags>
1313
<Title>Facturapi</Title>
14-
<Version>4.9.1</Version>
14+
<Version>4.10.0</Version>
1515
<PackageVersion>$(Version)</PackageVersion>
1616
<Owners>Facturapi</Owners>
1717
<ApplicationIcon>facturapi.ico</ApplicationIcon>

0 commit comments

Comments
 (0)