Skip to content

Commit

Permalink
[fix]コード整形
Browse files Browse the repository at this point in the history
  • Loading branch information
Kubosaka committed Aug 11, 2023
1 parent 0df89eb commit 69d7153
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions view/next-project/src/utils/createPurchaseOrderPdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export const createPurchasOrderFormPdf = async (
) => {
const pdfDoc = await PDFDocument.create();
pdfDoc.registerFontkit(fontkit);
// A4サイズのpdf作成
const page = pdfDoc.addPage([595.28, 841.89]);
const { width, height } = page.getSize();

// フォント「ナス」
const fontData = await pdfDoc.embedFont(
await (await fetch('./fonts/Nasu-Regular.ttf')).arrayBuffer(),
Expand All @@ -34,12 +38,10 @@ export const createPurchasOrderFormPdf = async (
return fontSizes[0];
}
};
// A4サイズのpdf作成
const page = pdfDoc.addPage([595.28, 841.89]);
const { width, height } = page.getSize();

//フォントのサイズ
const fontSizes = [12, 24];

// 内容の作成ここから
page.drawText('資料番号', {
x: 25,
y: height - 35,
Expand Down Expand Up @@ -447,10 +449,9 @@ export const createPurchasOrderFormPdf = async (
});
}
});

// 内容の作成ここまで
// 生成されたPDFデータを取得
const pdfBytes = await pdfDoc.save();

// Blobを作成
const blob = new Blob([pdfBytes], { type: 'application/pdf' });
return blob;
Expand Down

0 comments on commit 69d7153

Please sign in to comment.