<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: gaomc110</title>
    <description>The latest articles on DEV Community by gaomc110 (@gaomc110).</description>
    <link>https://dev.to/gaomc110</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3888032%2Fb882fa36-5365-4319-b324-40482c5cc66b.png</url>
      <title>DEV Community: gaomc110</title>
      <link>https://dev.to/gaomc110</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gaomc110"/>
    <language>en</language>
    <item>
      <title>[Open-source Recommendation] Web Print Designer vg-print Based on Vue 3/Vue 2 + Hiprint</title>
      <dc:creator>gaomc110</dc:creator>
      <pubDate>Mon, 20 Apr 2026 01:53:38 +0000</pubDate>
      <link>https://dev.to/gaomc110/open-source-recommendation-web-print-designer-vg-print-based-on-vue-3vue-2-hiprint-1bl6</link>
      <guid>https://dev.to/gaomc110/open-source-recommendation-web-print-designer-vg-print-based-on-vue-3vue-2-hiprint-1bl6</guid>
      <description>&lt;p&gt;In web development, printing functionality has always been a headache. Traditional CSS printing struggles to precisely control pagination, headers and footers, and complex layouts, while the printing plugins available on the market are either expensive or have complex integrations.&lt;/p&gt;

&lt;p&gt;Recently, in our project, we have encapsulated a set of out-of-the-box Vue 3/Vue 2 print design component libraries based on the renowned hiprint library, named vg-print. It not only supports visual drag-and-drop design templates but also integrates preview, PDF/image export, and even supports silent printing in conjunction with the client. Additionally, it is partially based on the functionality of vue-plugin-hiprint. Today, I would like to share this open-source project with everyone, hoping to assist developers and users who may need it.&lt;br&gt;
Why choose vg-print?&lt;br&gt;
vg-print is a printing solution based on the Vue 3 ecosystem (also supports Vue 2). It is not just a simple encapsulation of hiprint, but also provides a complete FullDesigner component.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgjd20sk3ttgu4iv9eyzh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgjd20sk3ttgu4iv9eyzh.png" alt=" " width="800" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Vue 2 version: If you are using Vue 2 with webpack 4.0 or above, please refer to vg-print-vue2&lt;/p&gt;

&lt;p&gt;The documentation is constantly being improved. If you have any questions, please contact me 👉 &lt;a href="https://www.yuque.com/designdev/vg-print" rel="noopener noreferrer"&gt;Click to enter vg-print developer documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Addressing core pain points:&lt;/p&gt;

&lt;p&gt;Visual design: No longer handwriting complex print styles, directly drag and drop to generate templates.&lt;br&gt;
Out of the box: The component can be used immediately after being introduced, without requiring cumbersome initialization configuration.&lt;br&gt;
Comprehensive functions: Supports preview, printing, exporting to PDF, exporting images, client-side exporting, and data source configuration.&lt;br&gt;
Silent printing: With built-in WebSocket connectivity, it can achieve click-to-print functionality in conjunction with the client, eliminating the need to pop up a browser print dialog box.&lt;br&gt;
Unlimited: No domain name restrictions, supports offline use, and is completely free. Feature display: Insert image description here. Main features: FullDesigner component: A fully functional designer that integrates a header action bar and preview function.&lt;/p&gt;

&lt;p&gt;Multi-format export: Built-in PDF and image export plugins to generate high-definition reports.&lt;/p&gt;

&lt;p&gt;Multi-language support: Supports multiple languages such as Chinese, English, and Japanese, making it suitable for international projects.&lt;/p&gt;

&lt;p&gt;Responsive layout: Automatically adapts to different screen sizes, with secondary buttons automatically collapsing on smaller screens. Quick start. Below is a demonstration of how to quickly integrate it into a Vue 3 project.&lt;/p&gt;

&lt;p&gt;Install dependencies&lt;/p&gt;

&lt;p&gt;To ensure consistency of print styles across different environments (such as preview and direct printing), it is recommended to import the style files into the project when using npm i vg-print.&lt;/p&gt;

&lt;p&gt;Using the FullDesigner component is the simplest integration method, which can be directly utilized within the page:&lt;/p&gt;

&lt;p&gt;            &amp;lt;!-- Customize the left side of the header --&amp;gt;              My Print Designer      
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  &amp;lt;!-- Customize the right button in the header --&amp;gt; &amp;lt;template #headerRight&amp;gt; &amp;lt;el-button type="primary" @click="handlePreview"&amp;gt;Preview&amp;lt;/el-button&amp;gt; &amp;lt;el-button type="success" @click="handlePrint"&amp;gt;Direct Print&amp;lt;/el-button&amp;gt; &amp;lt;/template&amp;gt; &amp;lt;/FullDesigner&amp;gt; &amp;lt;/div&amp;gt;&amp;lt;/template&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
import { ref } from 'vue'// Import the vg-print component (assuming it has been globally registered or locally imported)

const designer = ref(null)

// Initial template data (optional) const initialTemplate = { panels: [] }

// Print test data const printData = [{ name: 'Test User', id: 1001 }]

// Save template callback const handleSave = ({ template, data }) =&amp;gt; {  console.log('Saved template JSON:', JSON.stringify(template))  // Here you can save the template to the backend database}

// Call the internal method of the component const handlePreview = () =&amp;gt; {  designer.value?.value?.preView()}

const handlePrint = () =&amp;gt; {  designer.value?.value?.print()}

&lt;p&gt;.print-page {  height: 100vh;}.header-title {  font-size: 18px;  font-weight: bold;  color: #fff;  margin-left: 10px;}Advanced: Silent Printing For scenarios requiring high-frequency printing (such as express delivery labels and receipts), the browser's built-in print preview window can significantly affect efficiency. vg-print supports silent printing by connecting to a local client.&lt;/p&gt;

&lt;p&gt;Only need to configure hi-host and hi-token:&lt;/p&gt;

&lt;p&gt; in conjunction with the accompanying Electron client, allows for direct paper output upon clicking a button.&lt;br&gt;
Insert image description here&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fow85jvmtq43avf075kbu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fow85jvmtq43avf075kbu.png" alt=" " width="800" height="532"&gt;&lt;/a&gt;&lt;br&gt;
Download the accompanying client:&lt;/p&gt;

&lt;p&gt;To achieve silent printing, a specialized client tool needs to be installed. I have uploaded the compiled installation package to CSDN, and everyone can directly download and use it:&lt;/p&gt;

&lt;p&gt;👉 Click to download: Silent Print Client Tool (Windows/Mac)&lt;/p&gt;

&lt;p&gt;Welcome everyone to download and experience. If you have any questions, feel free to leave a message in the comment section&lt;/p&gt;


</description>
      <category>opensource</category>
      <category>showdev</category>
      <category>vue</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
