Phase2: Invoicecomputation/AdminpricingUI/Ainvoicemgnt
Some checks failed
Build and Push / build (push) Failing after 45s
Some checks failed
Build and Push / build (push) Failing after 45s
This commit is contained in:
@@ -26,9 +26,16 @@ export async function GET(
|
||||
if (!pdf) {
|
||||
return new NextResponse("Not found", { status: 404 });
|
||||
}
|
||||
// Construct a response that the browser will render inline (PDF
|
||||
// viewer) but also offer to download with the right filename.
|
||||
return new NextResponse(pdf.data, {
|
||||
// Web `Response`'s `BodyInit` doesn't include Node's `Buffer` — pg
|
||||
// returns bytea as Buffer but Next/the runtime want a BufferSource.
|
||||
// Wrap into a zero-copy Uint8Array view (Buffer extends Uint8Array
|
||||
// under the hood, but TypeScript treats them as distinct).
|
||||
const body = new Uint8Array(
|
||||
pdf.data.buffer,
|
||||
pdf.data.byteOffset,
|
||||
pdf.data.byteLength
|
||||
);
|
||||
return new NextResponse(body, {
|
||||
status: 200,
|
||||
headers: {
|
||||
"Content-Type": "application/pdf",
|
||||
|
||||
Reference in New Issue
Block a user