Pular para o conteúdo principal

Adicionar anexo a PDF em n8n

Adicionar anexo a PDF é um PDF4me ação do nó em n8n que incorpora um ou mais arquivos dentro de um PDFentão uma planilha, imagem, arquivo ou segundo PDF Acompanha o documento em vez de ser enviado ao lado. Use-o para incluir provas documentais em um contrato, enviar dados brutos junto com um relatório ou empacotar certificados com um documento de conformidade.

O que este nó faz

PDF4meAdicionar anexo a PDF leva um anfitrião PDF de Dados Binários, um Base64 Stringou um URL, e então incorpora cada arquivo que você lista em Anexos dentro dele como um objeto separado. Ao contrário da mesclagem, os arquivos anexados mantêm seu próprio formato e nome de arquivo e podem ser abertos ou salvos individualmente pelo destinatário. Cada anexo pode vir de uma fonte diferente, portanto, um arquivo binário de um nó anterior e um arquivo obtido de um nó posterior podem ser arquivos separados. URL podem ser incorporados na mesma execução.

Artigos relacionados no blogue
Ainda não há nenhuma publicação no blogue sobre esta funcionalidade — em breve.
Entretanto, explore o blogue da PDF4me para encontrar tutoriais e fluxos de trabalho para todas as plataformas.
Visite o blogue

Autenticando seu API Solicitar

Todo PDF4me nó em n8n requer um válido Credencial para se conectar comCrie ou selecione um que contenha o seu PDF4me API chave para que o fluxo de trabalho possa autenticar solicitações de anexos com segurança.

Fatos importantes que você não deve perder

Anexar não é mesclar
Um arquivo anexado permanece como um objeto separado que o leitor pode salvar novamente. A mesclagem, por sua vez, transforma o conteúdo da página em um único documento contínuo.
Anexos é uma coleção repetível
Clique Adicionar anexo uma vez por arquivo. Cada entrada possui seu próprio tipo de conteúdo, nome e origem, permitindo misturar binário, base64 e URL fontes em uma única execução.
A extensão do arquivo importa.
O nome do anexo indica ao aplicativo de leitura como abrir o arquivo extraído, portanto, sempre inclua a extensão correta, como .xlsx ou .zip.
O nó PDF4me no n8n está configurado com a ação "Adicionar anexo ao PDF", o tipo de dados de entrada "Dados binários", o campo de entrada "dados binários", o nome do arquivo de saída "document_with_attachments.pdf", o nome do documento "document.pdf" e uma coleção de anexos vazia com um botão "Adicionar anexo".

PDF4me Adicionar anexo a PDF painel de parâmetros em n8n, com a coleção Attachments vazia antes da adição da primeira entrada.

Anexar vs. Unir vs. Compactar

Três maneiras de entregar vários arquivos como um só, com consequências diferentes para o destinatário.

AbordagemO que o destinatário recebeMelhor ajuste
Add Attachment to PDFOne PDF that opens normally, with the extra files available in the attachments panelSupporting material that must stay in its original format, such as a spreadsheet or an archive
Merge PDFsOne continuous document where all pages read in sequenceContent that genuinely belongs together as a single readable document
Zip the files togetherAn archive that must be unpacked before anything can be readBulk transfer where nothing needs to be readable without extracting first

Quais parâmetros a opção "Adicionar anexo" define? PDF Precisar?

Obrigatório: Ação, Tipo de Dados de Entrada, o campo correspondente a esse tipo de entrada, Nome do Arquivo de Saída, Nome do Documento e pelo menos uma entrada em Anexos. O Nome de Saída de Dados Binários e os Perfis Personalizados possuem valores padrão funcionais.

ParâmetroObrigatórioO que fazExemplo
ActionRequiredSelects the PDF4me node action to run. Choose Add Attachment To PDF.Add Attachment To PDF
Input Data TypeRequiredFormat of the host PDF input. Choose Binary Data (from a previous node), Base64 String, or URL.Binary Data
Input Binary FieldConditionalName of the binary property on the incoming n8n item that holds the host PDF. Required when Input Data Type is Binary Data. Defaults to data.data
Base64 Document ContentConditionalBase64-encoded content of the host PDF. Required when Input Data Type is Base64 String.JVBERi0xLjQK...
File URLConditionalPublicly reachable HTTPS URL to the host PDF. Required when Input Data Type is URL.https://example.com/contract.pdf
Output File NameRequiredFilename for the PDF returned with the files embedded. Include the .pdf extension.document_with_attachments.pdf
Document NameRequiredFilename of the source PDF, used for reference and tracking on the request.document.pdf
AttachmentsRequiredCollection of files to embed. Click Add Attachment once per file, then fill in the per-attachment fields listed below.One entry per embedded file
Binary Data Output NameOptionalName of the binary property the output item exposes. Defaults to data.data
Custom ProfilesOptionalAdvanced Options field for extra processing settings, supplied in a JSON-like format. Leave blank unless you have a specific profile to apply.{ "preserveMetadata": true }

Campos dentro de cada entrada de anexo

Cada entrada que você cria com Adicionar anexo expõe seu próprio conjunto de campos.

ParâmetroObrigatórioO que fazExemplo
Attachment Content TypeRequiredHow this particular attachment is supplied. Choose Binary Data, Base64 Content, or File URL. Each entry can differ.Binary Data
Attachment NameRequiredFilename the embedded file will carry inside the PDF. Include the correct extension so readers can open it after extraction.supporting_data.xlsx
Binary Field NameConditionalName of the binary property holding this attachment. Required when Attachment Content Type is Binary Data.data
Base64 ContentConditionalBase64-encoded content of this attachment. Required when Attachment Content Type is Base64 Content.SGVsbG8gV29ybGQ=
File URLConditionalPublicly reachable HTTPS URL to this attachment. Required when Attachment Content Type is File URL.https://example.com/certificate.pdf

Campos de saída

Uma corrida bem-sucedida retorna um n8n item que carrega o PDF com seus arquivos incorporados.

CampoTipoO que contém
Binary (data)BinaryThe PDF with all listed files embedded, under Binary Data Output Name (default data).
fileNameStringGenerated filename, matching Output File Name.
mimeTypeStringMIME type of the output, always application/pdf.
fileSizeNumberSize of the returned PDF in bytes, including the embedded files.
attachmentCountNumberNumber of attachments successfully embedded. Compare it against your expected count to catch a silently skipped file.
successBooleanTrue when the attachment operation completed, false on failure. Use it to branch error handling.
messageStringHuman-readable status message, carrying success confirmation or error detail.

Como faço para configurar a opção "Adicionar anexo"? PDF em n8n?

  1. Adicionar PDF4me para o seu n8n fluxo de trabalho e escolha o Adicionar anexo a PDF Ação.
  2. Em Credencial para se conectar com, selecione o seu PDF4me credencial ou clique Criar nova credencial e cole o seu API chave.
  3. Definir Tipo de dados de entrada para Dados binários (padrão), Base64 String, ou URL e fornecer o host correspondente PDF campo.
  4. Sob Anexos, clique Adicionar anexo uma vez para cada arquivo, depois defina-o Tipo de conteúdo do anexo, Nome do anexoe campo de origem correspondente.
  5. Definir Nome do arquivo de saída (deve terminar em .pdf) e Nome do documento para o arquivo fonte.
  6. Execute o nó e direcione o retorno. PDF Em frente, verificando attachmentCount em relação ao número de arquivos que você esperava.

Configurações típicas

Exemplos de fluxo de trabalhoCommon n8n workflow patterns using Add Attachment to PDF.
Fatura com comprovantes de pagamento
  1. Uma fatura PDF é gerado a partir de dados de faturamento.
  2. Adicionar anexo a PDF Incorpora os recibos correspondentes e o registro de aprovação.
  3. Um dos arquivos é encaminhado ao departamento de contas a pagar, contendo todo o histórico de evidências.
Relatório com seus dados de origem
  1. Um relatório analítico agendado é apresentado ao PDF.
  2. Adicionar anexo a PDF incorpora o subjacente CSV Exportar como anexo nomeado.
  3. Os leitores têm acesso à narrativa e podem consultar os números brutos quando desejarem verificá-los.
Contrato com anexos
  1. Um contrato é gerado a partir de um modelo mediante solicitação de assinatura.
  2. Adicionar anexo a PDF incorpora certificados e cronogramas extraídos de URLs.
  3. A contraparte recebe um único documento autossuficiente para assinar.
Pacote de conformidade para auditoria
  1. Um nó "Loop Over Items" reúne arquivos de evidências para um determinado período de arquivamento.
  2. Adicionar anexo a PDF incorpora cada um deles no documento de capa.
  3. O pacote está arquivado e o anexo pode ser extraído de PDF Podemos desembalar mais tarde, mediante solicitação.

Dicas práticas

Always include the file extension in Attachment Name
The extension is what tells a reader application how to open the extracted file. A name without one leaves the recipient guessing.
Check attachmentCount against what you sent
Comparing the returned count to the number of entries you configured is the quickest way to catch a file that failed to embed.
Mention the attachments in the document body
Not every viewer surfaces the attachments panel, so a line of visible text telling the reader that supporting files are embedded prevents them being missed.
Mix sources freely within one run
Each entry has its own content type, so a binary file from an earlier node and a URL-hosted certificate can be embedded together.
Attach when format must survive, merge when it should not
A spreadsheet stays usable as a spreadsheet only if it is attached. Merging would flatten it into page content.
Watch the total size on outbound email
Embedded files count toward the PDF size, so a bundle of large attachments can push the document past a mail gateway limit.

Folha de dicas

CampoValor
ActionAdd Attachment To PDF
Input Data TypeBinary Data
Input Binary Fielddata
Output File Namedocument_with_attachments.pdf
Document Namedocument.pdf
AttachmentsOne entry per file, added with Add Attachment
Attachment Content TypeBinary Data
Attachment Namesupporting_data.xlsx
Binary Data Output Namedata
CredentialsPDF4me API credential

Perguntas frequentes

What is the difference between attaching a file to a PDF and merging PDFs?+
Merging combines page content into one continuous document, so the source files stop existing as separate items. Attaching embeds a file inside the PDF as a discrete object that a reader can open or save back out on its own, keeping the original format intact. Use merge when everything should read as one document, and attach when a spreadsheet, archive, or certificate needs to stay a separate file.
Can I attach more than one file in a single run?+
Yes. Attachments is a collection, so click Add Attachment once per file you want to embed. Each entry gets its own Attachment Content Type, Attachment Name, and source field, which means you can mix a binary file from a previous node with another pulled from a URL in the same request.
What file types can be attached to a PDF?+
Attachments are stored as embedded file objects rather than being converted, a mechanism defined in the ISO 32000 PDF specification, so common document, image, spreadsheet, presentation, archive, and data formats can all be carried. What matters is that Attachment Name includes the correct extension, because that is what tells a reader application how to open the file once extracted.
Will everyone be able to see the attachments?+
Embedded files are exposed through the attachments or bookmarks panel of a full PDF reader. Lightweight in-browser or mobile viewers sometimes do not surface that panel, so if attachments are essential to the recipient, mention in the document body that supporting files are embedded.
How do I get the attachments back out of a PDF later?+
Use the Extract Attachment From PDF action, which is the inverse operation. A common pattern is one n8n workflow that bundles supporting files into an outgoing PDF, and a second that extracts them again when the document comes back.

Ações relacionadas

Mesma tarefa em outras plataformas

Obtenha ajuda