원클릭으로
getting-started
Generate PDFs through API2PDF in NestJS. Use when converting HTML or URLs to PDFs in apis.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Generate PDFs through API2PDF in NestJS. Use when converting HTML or URLs to PDFs in apis.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Use when scanning NestJS providers with DiscoveryService-backed utilities.
Use when working with the @wisemen/nestjs-custom-fields package — developer-defined custom fields in NestJS with TypeORM persistence and runtime validation. Covers registering the CustomFieldDefinition entity, authoring definitions with customFieldDefinition(), storing resolved values via @CustomFieldValueColumn(), exposing them through CustomFieldValueDto / @IsCustomFields(), and validating submissions with CustomFieldDefinitionsRepository + validateCustomFieldValues(). Use this whenever a task involves custom field definitions, CustomFieldValue columns, custom-field DTOs, or tenant-scoped field definitions, even if the package is not named explicitly.
Use when defining Typesense collections, collectors, and search queries in NestJS APIs.
Use when storing and validating multilingual text in NestJS apis with TypeORM and class-validator.
Use when configuring NATS messaging, subscribers, or the simple NatsClient in NestJS applications.
Use when writing tests for NestJS api packages with custom expect matchers, domain events, or transactional TypeORM use cases.
| name | getting-started |
| description | Generate PDFs through API2PDF in NestJS. Use when converting HTML or URLs to PDFs in apis. |
useFactory that switches on NODE_ENVimport { Module } from '@nestjs/common'
import { ConfigService } from '@nestjs/config'
import { Api2PdfModule } from '@wisemen/nestjs-api-2-pdf'
@Module({
imports: [
Api2PdfModule.forRootAsync({
inject: [ConfigService],
useFactory: (config: ConfigService) => {
if (config.getOrThrow('NODE_ENV') === 'test') {
return {
provider: 'mock'
}
}
return {
provider: 'api2pdf',
apiKey: config.getOrThrow('API2PDF_API_KEY'),
baseUrl: config.getOrThrow('API2PDF_BASE_URL')
}
}
})
],
exports: [Api2PdfModule]
})
export class DefaultApi2PdfModule {}
import { Injectable } from '@nestjs/common'
import { Api2PdfClient } from '@wisemen/nestjs-api-2-pdf'
@Injectable()
export class InvoicePdfService {
constructor(private readonly pdfClient: Api2PdfClient) {}
async generate(uploadUrl: string, html: string): Promise<void> {
await this.pdfClient.generatePdfFromHtml({
html,
uploadUrl,
fileName: 'invoice.pdf',
inline: false
})
}
}
await this.pdfClient.generatePdfFromUrl({
url: 'https://example.com/invoice/123',
uploadUrl,
fileName: 'invoice.pdf',
inline: false,
extraHTTPHeaders: {
'Accept-Language': locale
}
})
generatePdfFromHtml() and generatePdfFromUrl() support:
fileNameuploadUrl url location where the resulting pdf will be uploaded (with a PUT method)inline: true to open in the browser, false to trigger download behavior.options for layout settings like landscape, printBackground, marginTop, marginLeft, marginRightstorage.extraHTTPHeaders for headers sent with the upload requestApi2PdfClient regardless of whether the configured provider is api2pdf or mock.uploadUrl with a PUT request.generatePdfFromUrl() has optional ensureReachable option. This option validates if the passed url is reachable, before sending to API2PDF. This ensures that API2PDF does not take a screenshot of an unreachable endpoint (eg 503), since puppeteer option WaitForNavigation sees the 503 response as a navigation.