Replies: 21 comments 35 replies
-
|
Thank you for your work on additional schema support. I'm interested in printing maps with pdfme, where maps would be embedded in the PDF together with other content. |
Beta Was this translation helpful? Give feedback.
-
|
I have created a schema for the signature. Playground: playground.pdfme.com |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
MEMO
|
Beta Was this translation helpful? Give feedback.
-
|
Not sure if this makes sense, but a set of "common" types could ensure that input data is formatted correctly. With "common types" I mean for example:
Or others like:
Do you already have some sort of documentation how to correctly add plugins/schema? |
Beta Was this translation helpful? Give feedback.
-
|
Hi ... I would need a checkbox schema :) ... thank you |
Beta Was this translation helpful? Give feedback.
-
|
Hi... I had a need in the image schema, I made a change to meet it, an opacity option in the images, a practical example, like a watermark. It would be interesting to be in the Git Hub source code, so I don't need to control the source separately. Result: |
Beta Was this translation helpful? Give feedback.
-
|
I've started some dev on making a form text field plugin, it's like a cut down text plugin, but means the output is editable in the final pdf. Is the intent to make plugins stand alone, or move them into the main pdfme/plugins module? |
Beta Was this translation helpful? Give feedback.
-
|
Would be really nice to have support for checkboxes and radioboxes! Going further, it would be even cooler to have support for conditional rendering of additional static data/form inputs based on the state of such checkboxes/radioboxes. |
Beta Was this translation helpful? Give feedback.
-
|
Hey @hand-dot do you have any plugin coded which is like a row container having no. of columns like flex row and children will be reltive to that parent container |
Beta Was this translation helpful? Give feedback.
-
|
hi @hand-dot , you are doing some amazing work there. I am a freelancer and using pdfme in one of my ongoing projects. Your library is the nicest abstraction that meet our needs. We understand that pdfme is under ongoing development. here are some features we would love to have. Fillable checkboxes, options, calendar date picker. We are thinking of creating our own plugins for the time being. If anyone from the community have such solutions already built, please do share. That would be really helpful. |
Beta Was this translation helpful? Give feedback.
-
|
Hi @hand-dot, Here are 3 requirements I'm not sure it's already accomplished.
|
Beta Was this translation helpful? Give feedback.
-
|
I was looking for a way to create a field that would be editable after the PDF is exported similar to what @jedimonkey mentioned here. I wasn't able to find support to it on the lib or any plugin. Posting it here in case someone knows a plugin or a workaround to achieve it. Thanks |
Beta Was this translation helpful? Give feedback.
-
Variable font/Bold, italics, bold-italic supportHii @hand-dot, My end goal is to add a schema for rich-text field. Current implementation in v5.2.10 const fontObjList = [
{
fallback: true,
label: 'NotoSerifJP-Regular',
url: '/fonts/NotoSerifJP-Regular.otf',
},
{
fallback: false,
label: 'NotoSansJP-Regular',
url: '/fonts/NotoSansJP-Regular.otf',
},
{
fallback: false,
label: DEFAULT_FONT_NAME,
data: getDefaultFont()[DEFAULT_FONT_NAME].data,
},
];Desired implementation [would you consider this implementation reasonable] // variants would be optional
// if a variant is not found fallback to regular font
const fontObjList = [
{
fallback: true,
label: 'NotoSerifJP',
url: '/fonts/NotoSerifJP-Regular.otf'
variants: {
bold: '/fonts/NotoSerifJP-Bold.otf'
italic: '/fonts/NotoSerifJP-Italic.otf'
boldItalic: '/fonts/NotoSerifJP-BoldItalic.otf'
}
},
{
fallback: false,
label: 'NotoSansJP',
url: '/fonts/NotoSansJP-Regular.otf',
// no variants avaiable for this font
},
{
fallback: false,
label: DEFAULT_FONT_NAME,
data: getDefaultFont()[DEFAULT_FONT_NAME].data,
},
];TextSchema modifications {
// ... other properties,
bold?: boolean,
// or
fontWeight?: 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900,
italic?: boolean
} |
Beta Was this translation helpful? Give feedback.
-
|
Hey @hand-dot, guidecreate schemas directory where you need it and copy anything from import { PDFRenderProps, Plugin } from "@pdfme/common";
import { PDFString } from "@pdfme/pdf-lib";
import { Link } from "lucide";
import text from "../text";
import { pdfRender as parentPdfRender } from "../text/pdfRender";
import { TextSchema } from "../text/types";
import { convertForPdfLayoutProps, createSvgStr } from "../utils";
// inputs : [["text","url"]]
export interface LinkSchema extends TextSchema {
url: string;
}
export const link: Plugin<LinkSchema> = {
ui: text.ui,
pdf: async (arg: PDFRenderProps<LinkSchema>) => {
const { value, pdfDoc, schema, page, ...rest } = arg;
const pageHeight = page.getHeight();
const {
width,
height,
position: { x, y },
} = convertForPdfLayoutProps({ schema, pageHeight, applyRotateTranslate: false });
const values: string[][] = JSON.parse(value);
page.node.addAnnot(
pdfDoc.context.register(
pdfDoc.context.obj({
Type: "Annot",
Subtype: "Link",
Rect: [x, y, x + width, y + height],
// Border: [0, 0, 0],
// border color
// C: [0, 0, 1],
// URI action
A: {
Type: "Action",
S: "URI",
URI: PDFString.of(values[0][1]),
// still searching for that one
// target: "_blank",
},
}),
),
);
const renderArgs = {
value: values[0][0],
pdfDoc: pdfDoc,
schema,
page: page,
...rest,
};
await parentPdfRender(renderArgs);
},
propPanel: {
schema: text.propPanel.schema,
defaultSchema: {
...text.propPanel.defaultSchema,
rotate: undefined,
type: "link",
url: "",
},
},
icon: createSvgStr(Link),
};
export default link;edit import barcodes from "./barcodes/index";
import checkbox from "./checkbox/index";
import date from "./date/date";
import dateTime from "./date/dateTime";
import time from "./date/time";
import image from "./graphics/image";
import svg from "./graphics/svg";
// link added
import link from "./link/link";
import multiVariableText from "./multiVariableText/index";
import radioGroup from "./radioGroup/index";
import select from "./select/index";
import line from "./shapes/line";
import { ellipse, rectangle } from "./shapes/rectAndEllipse";
import table from "./tables/index";
import text from "./text/index";
const builtInPlugins = { Text: text };
export {
barcodes,
builtInPlugins,
checkbox,
date,
dateTime,
ellipse,
image,
line,
multiVariableText,
radioGroup,
rectangle,
select,
svg,
table,
text,
time,
// link added
link,
}; |
Beta Was this translation helpful? Give feedback.
-
Feature Request: Enhanced Text Styling Options for PDFmeCurrently, PDFme's text schema lacks built-in support for rich text formatting, which limits design flexibility when generating PDF templates. I propose adding comprehensive text styling options that would include: 1. Text Formatting Capabilities
2. Potential Implementation Approaches// Example proposed schema structure
{
type: 'text',
text: 'Sample Text',
fontStyle: {
bold: true,
italic: false,
underline: false
}
}3. Key Benefits
Technical Considerations
Example Implementation Prototypeconst richTextPlugin = {
ui: (props) => {
const { schema, value } = props;
const span = document.createElement('span');
span.textContent = value;
// Apply styling based on fontStyle configuration
span.style.fontWeight = schema.fontStyle?.bold ? 'bold' : 'normal';
span.style.fontStyle = schema.fontStyle?.italic ? 'italic' : 'normal';
span.style.textDecoration = schema.fontStyle?.underline ? 'underline' : 'none';
},
pdf: (props) => {
// Custom PDF rendering logic
}
};Questions for Community
I'm happy to collaborate on refining this proposal and potentially contribute a pull request if there's community interest. |
Beta Was this translation helpful? Give feedback.
-
Custom plugin for QR-code (using pdfmake)https://gist.github.com/Myshanyatko/f0fca460ae8f1bb6aa3e250362b623c8 This plugin was created because I needed QR code rendering in pdfme, but didn't want to depend on libraries like antd, form-render, and react that are used by @pdfme/schemas for QR codes. This plugin uses the pdfmake library to render QR codes, and it embeds them into your PDF as PDF-formatted content. This solution was convenient for me because the pdfmake library was already installed in the project. :) '+': Draw qr-code without using new heavy versions of |
Beta Was this translation helpful? Give feedback.
-
Proposed countermeasure for overflow generated by TextSchemaHi @hand-dot Today I would like to propose a feature in pdfme text display that does not display strings that are out of bounds. SummaryProblem Text in We feel that the current situation is a challenge for documents where layout is important, such as invoices and estimates, where text processing and validation cannot follow the pdfme rendering logic. Proposal I would like to add a new boolean option to advantage
Detail1. Problem to be solved (Problem / Motivation)Current Problem Points:The TextSchema overflows the string from the frame, but there doesn't seem to be a way to prevent this in the pdfme. I would like to Contribute, but there may be an idea that it should be a custom schema or Fork depending on the content, so I will post it in Discussion. Specific Use Case:I have set DynamicFontSize in TextSchema to allow users to type more characters (this is a very nice feature!!!). However, I am having usability and technical challenges when creating templates for official documents such as invoices, quotations, and contracts. 1. issue from the user's point of view Over-extending the size of TextSchema to accommodate more text is not very practical for formal documents such as ledgers. Therefore, an approach was needed that would allow DynamicFontSize to work, but still keep the text completely within the boundaries of the box. 2. Technical issues It is “technically possible” to truncate or validate the string input to Template based on the number of characters or lines so that the input string fits within the frame. However, since pdfme internally (pdfRender) manages the strings to be displayed as “lines,” duplicating the logic involved in PDF rendering resulted in poor performance with Rutime. Furthermore, many other helpers and utilities are not exported from pdfme, so it is currently difficult to process and validate text using the same display decisions as pdfme by means other than Fork. 2. Proposed SolutionTo solve this problem, we propose to “add an option to TextSchema to not display overflow strings”. Specifically
Advantages of this solution
3. Alternatives consideredIn addition to this proposal, the following alternatives were also considered Alternative: Implement a TextSchema wrapper for product use cases.Reason not selected: As mentioned above, this alternative was not selected because the logic of interest, PDF rendering for Input, is covered by the internal implementation. It is possible to approximate text parsing and processing with Intl.Segmenter and pdfme/common so that the input string can be displayed as is, but the performance degradation and DynamicFontSize support made this difficult. Therefore, we believe our proposal is the most balanced at this time. I'd appreciate your feedback on this proposal. If you agree with this direction, I'm happy to work on a pull request. |
Beta Was this translation helpful? Give feedback.
-
|
I found in general using tables but sometimes you need some custom logic. Example: What i found is custom table that will give user schema spesficiation Example User selects Custom table in code user can defines their arrays Customers user defines them this table we have will only has 1 row user will see and can't have more and in this part user can add headers and reference values from the given schema Example header for customer Customer Name then user can go ahead and in the 1 row they have go ${customer.name} // Optinally null and undefined behavior also can be added and then goes ahead and writes json-rules-engine code directly given input field in the custom rules section in the table with this custom rules we can spesify only render customer that starts with C or T etc... With this assume that you have a transaction list that has 35 columns in your database and want to make so users can customize what is printed You will define it and all its columns User goes ahead and defines what it want maybe they just wants to show amount and currency and nothing more they can just add them add their own custom rules Maybe its vacations we can create it depending on our vacation data in code like i explained |
Beta Was this translation helpful? Give feedback.
-
Feature Request: Page Options for PDFme UIWith the current version of Pdfme UI, it is not possible to add a new page with:
Description of the featureIt would be awesome to add the ability to specify page options when adding a new page, such as:
This enhancement would provide greater flexibility and control over PDF creation within the UI. Possible Solutions
|
Beta Was this translation helpful? Give feedback.
-
Embed PDF ImageFor the automatic creation of data sheets, I need to embed CAD drawings. These drawings are provided as PDFs, and I initially tried converting them to SVG using muPDF and then embedding them via the SVG plugin. Unfortunately, that approach did not work reliably: in some cases only the text was visible, in others only the drawing, and sometimes both appeared but were rendered on top of each other incorrectly. For testing:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
You can propose ideas for plugins that can be used in pdfme V3 and beyond while discussing them here.
If there is a need for certain features that should be supported, we can create a separate issue for them. However, this is a good place to have various exchanges of opinions.
If you've created a schema, please do report it here. Your plugin should be able to solve problems for the community and new users.
Document - Custom Schemas(Plugins) : https://pdfme.com/docs/custom-schemas
Beta Was this translation helpful? Give feedback.
All reactions