iText实战--在现有PDF上工作

6.1 使用PdfReader读取PDF

检索文档和页面信息

D:/data/iText/inAction/chapter03/image_direct.pdf
Number of pages: 1
Size of page 1: [0.0,0.0,283.0,416.0]
Rotation of page 1: 0
Page size with rotation of page 1: Rectangle: 283.0x416.0 (rot: 0 degrees)
Is rebuilt? false
Is encrypted? false

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Rectangle;
import com.itextpdf.text.pdf.PdfReader;public class PageInformation {/** The resulting text file with info about a PDF. */public static final String RESULT= "D:/data/iText/inAction/chapter06/page_info.txt";/*** Main method.* @param args no arguments needed* @throws DocumentException * @throws IOException*/public static void main(String[] args)throws DocumentException, IOException {// Inspecting PDFsPrintWriter writer = new PrintWriter(new FileOutputStream(RESULT));inspect(writer, "D:/data/iText/inAction/chapter03/image_direct.pdf");writer.close();}/*** Inspect a PDF file and write the info to a txt file* @param writer Writer to a text file* @param filename Path to the PDF file* @throws IOException*/public static void inspect(PrintWriter writer, String filename)throws IOException {PdfReader reader = new PdfReader(filename);writer.println(filename);writer.print("Number of pages: ");writer.println(reader.getNumberOfPages());Rectangle mediabox = reader.getPageSize(1);writer.print("Size of page 1: [");writer.print(mediabox.getLeft());writer.print(',');writer.print(mediabox.getBottom());writer.print(',');writer.print(mediabox.getRight());writer.print(',');writer.print(mediabox.getTop());writer.println("]");writer.print("Rotation of page 1: ");writer.println(reader.getPageRotation(1));writer.print("Page size with rotation of page 1: ");writer.println(reader.getPageSizeWithRotation(1));writer.print("Is rebuilt? ");writer.println(reader.isRebuilt());writer.print("Is encrypted? ");writer.println(reader.isEncrypted());writer.println();writer.flush();}
}

Page Size 页面大小

损坏的PDF

加密的PDF

使用PdfReader降低内存

部分读取

    /*** Do a full read of a PDF file* @param writer a writer to a report file* @param filename the file to read* @throws IOException*/public static void fullRead(PrintWriter writer, String filename)throws IOException {long before = getMemoryUse();PdfReader reader = new PdfReader(filename);reader.getNumberOfPages();writer.println(String.format("Memory used by full read: %d",getMemoryUse() - before));writer.flush();}/*** Do a partial read of a PDF file* @param writer a writer to a report file* @param filename the file to read* @throws IOException*/public static void partialRead(PrintWriter writer, String filename)throws IOException {long before = getMemoryUse();PdfReader reader = new PdfReader(new RandomAccessFileOrArray(filename), null);reader.getNumberOfPages();writer.println(String.format("Memory used by partial read: %d",getMemoryUse() - before));writer.flush();}

选择页面

PdfReader.selectPages("3");

PdfReader.selectPages("4-8");

执行selectPages()后,页数就变成选中的实际页数,要注意越界。

import java.io.FileOutputStream;
import java.io.IOException;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.pdf.PdfCopy;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfStamper;public class SelectPages {/** A resulting PDF file. */public static final String RESULT1 = "results/part2/chapter06/timetable_stamper.pdf";/** A resulting PDF file. */public static final String RESULT2 = "results/part2/chapter06/timetable_copy.pdf"; /*** Main method.* @param args no arguments needed* @throws DocumentException * @throws IOException*/public static void main(String[] args) throws IOException, DocumentException {PdfReader reader = new PdfReader("D:/data/iText/inAction/chapter03/movie_posters.pdf");reader.selectPages("4-8");manipulateWithStamper(reader);manipulateWithCopy(reader);}/*** Creates a new PDF based on the one in the reader* @param reader a reader with a PDF file* @throws IOException* @throws DocumentException*/private static void manipulateWithStamper(PdfReader reader)throws IOException, DocumentException {PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(RESULT1));stamper.close();}/*** Creates a new PDF based on the one in the reader* @param reader a reader with a PDF file* @throws IOException* @throws DocumentException*/private static void manipulateWithCopy(PdfReader reader)throws IOException, DocumentException {int n = reader.getNumberOfPages();Document document = new Document();PdfCopy copy = new PdfCopy(document, new FileOutputStream(RESULT2));document.open();for (int i = 0; i < n;) {copy.addPage(copy.getImportedPage(reader, ++i));}document.close();}}

6.2 从PDF拷贝页面

导入页面

import java.io.FileOutputStream;
import java.io.IOException;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Image;
import com.itextpdf.text.pdf.PdfImportedPage;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfWriter;public class ImportingPages1 {/** The resulting PDF file. */public static final String RESULT= "D:/data/iText/inAction/chapter06/time_table_imported1.pdf";/*** Main method.* @param args no arguments needed* @throws DocumentException * @throws IOException*/public static void main(String[] args)throws IOException, DocumentException {// step 1Document document = new Document();// step 2PdfWriter writer= PdfWriter.getInstance(document, new FileOutputStream(RESULT));// step 3document.open();// step 4PdfPTable table = new PdfPTable(2);PdfReader reader = new PdfReader("D:/data/iText/inAction/chapter03/movie_posters.pdf");int n = reader.getNumberOfPages();PdfImportedPage page;for (int i = 1; i <= n; i++) {page = writer.getImportedPage(reader, i);table.addCell(Image.getInstance(page));}document.add(table);// step 5document.close();}
}

缩放和叠加页面

叠加PDF页面

import java.io.FileOutputStream;
import java.io.IOException;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Element;
import com.itextpdf.text.Font;
import com.itextpdf.text.Image;
import com.itextpdf.text.PageSize;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.Font.FontFamily;
import com.itextpdf.text.pdf.BaseFont;
import com.itextpdf.text.pdf.PdfContentByte;
import com.itextpdf.text.pdf.PdfGState;
import com.itextpdf.text.pdf.PdfImportedPage;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfWriter;public class Layers {/** The resulting PDF. */public static final String SOURCE= "D:/data/iText/inAction/chapter06/layers_orig.pdf";/** The resulting PDF. */public static final String RESULT= "D:/data/iText/inAction/chapter06/layers.pdf";/** The movie poster. */public static final String RESOURCE= "E:/study/PDF/SourceCodeiText/itext-book/book/resources/img/loa.jpg";/*** Main method.* @param args no arguments needed* @throws DocumentException * @throws IOException*/public static void main(String[] args)throws IOException, DocumentException {new Layers().createPdf(SOURCE);// Create a readerPdfReader reader = new PdfReader(SOURCE);// step 1Document document = new Document(PageSize.A5.rotate());// step 2PdfWriter writer= PdfWriter.getInstance(document, new FileOutputStream(RESULT));// step 3document.open();// step 4PdfContentByte canvas = writer.getDirectContent();PdfImportedPage page;BaseFont bf= BaseFont.createFont(BaseFont.ZAPFDINGBATS, "", BaseFont.EMBEDDED);for (int i = 0; i < reader.getNumberOfPages(); ) {page = writer.getImportedPage(reader, ++i);canvas.addTemplate(page, 1f, 0, 0.4f, 0.4f, 72, 50 * i);canvas.beginText();canvas.setFontAndSize(bf, 20);canvas.showTextAligned(Element.ALIGN_CENTER,String.valueOf((char)(181 + i)), 496, 150 + 50 * i, 0);canvas.endText();}// step 5document.close();}/*** Creates a PDF document.* @param filename the path to the new PDF document* @throws    DocumentException * @throws    IOException*/public void createPdf(String filename)throws IOException, DocumentException {// step 1Document document = new Document(PageSize.POSTCARD, 30, 30, 30, 30);// step 2PdfWriter writer = PdfWriter.getInstance(document,new FileOutputStream(filename));// step 3document.open();// step 4PdfContentByte under = writer.getDirectContentUnder();// Page 1: a rectangledrawRectangle(under, PageSize.POSTCARD.getWidth(), PageSize.POSTCARD.getHeight());under.setRGBColorFill(0xFF, 0xD7, 0x00);under.rectangle(5, 5, PageSize.POSTCARD.getWidth() - 10, PageSize.POSTCARD.getHeight() - 10);under.fill();document.newPage();// Page 2: an imagedrawRectangle(under, PageSize.POSTCARD.getWidth(), PageSize.POSTCARD.getHeight());Image img = Image.getInstance(RESOURCE);img.setAbsolutePosition((PageSize.POSTCARD.getWidth() - img.getScaledWidth()) / 2,(PageSize.POSTCARD.getHeight() - img.getScaledHeight()) / 2);document.add(img);document.newPage();// Page 3: the words "Foobar Film Festival"drawRectangle(under, PageSize.POSTCARD.getWidth(), PageSize.POSTCARD.getHeight());;Paragraph p = new Paragraph("Foobar Film Festival", new Font(FontFamily.HELVETICA, 22));p.setAlignment(Element.ALIGN_CENTER);document.add(p);document.newPage();// Page 4: the words "SOLD OUT"drawRectangle(under, PageSize.POSTCARD.getWidth(), PageSize.POSTCARD.getHeight());PdfContentByte over = writer.getDirectContent();over.saveState();float sinus = (float)Math.sin(Math.PI / 60);float cosinus = (float)Math.cos(Math.PI / 60);BaseFont bf = BaseFont.createFont();over.beginText();over.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE);over.setLineWidth(1.5f);over.setRGBColorStroke(0xFF, 0x00, 0x00);over.setRGBColorFill(0xFF, 0xFF, 0xFF);over.setFontAndSize(bf, 36);over.setTextMatrix(cosinus, sinus, -sinus, cosinus, 50, 324);over.showText("SOLD OUT");over.setTextMatrix(0, 0);over.endText();over.restoreState();// step 5document.close();}/*** Draws a rectangle* @param content the direct content layer* @param width the width of the rectangle* @param height the height of the rectangle*/public static void drawRectangle(PdfContentByte content, float width, float height) {content.saveState();PdfGState state = new PdfGState();state.setFillOpacity(0.6f);content.setGState(state);content.setRGBColorFill(0xFF, 0xFF, 0xFF);content.setLineWidth(3);content.rectangle(0, 0, width, height);content.fillStroke();content.restoreState();}
}

导入公司信封

从第N页复制页面

6.3 使用PdfStamper添加内容

在绝对位置添加内容

PdfStamper.getOverContent() 类似 getDirectContent()

import java.io.FileOutputStream;
import java.io.IOException;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Element;
import com.itextpdf.text.Phrase;
import com.itextpdf.text.pdf.ColumnText;
import com.itextpdf.text.pdf.PdfContentByte;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfStamper;
import com.ygsoft.abc.component.cdes.itext.chapter1.HelloWorldLandscape1;
import com.ygsoft.abc.component.cdes.itext.chapter1.HelloWorldLandscape2;public class StampText {/** A resulting PDF file. */public static final String RESULT1= "D:/data/iText/inAction/chapter06/hello1.pdf";/** A resulting PDF file. */public static final String RESULT2= "D:/data/iText/inAction/chapter06/hello2.pdf";/** A resulting PDF file. */public static final String RESULT3= "D:/data/iText/inAction/chapter06/hello3.pdf";/*** Main method.* @param args no arguments needed* @throws DocumentException * @throws IOException*/public static void main(String[] args)throws DocumentException, IOException {HelloWorldLandscape1.main(args);HelloWorldLandscape2.main(args);stamp(HelloWorldLandscape1.RESULT, RESULT1);stampIgnoreRotation(HelloWorldLandscape1.RESULT, RESULT2);stamp(HelloWorldLandscape2.RESULT, RESULT3);}/*** Manipulates a PDF file src with the file dest as result* @param src the original PDF* @param dest the resulting PDF* @throws IOException* @throws DocumentException*/public static void stamp(String src, String dest)throws IOException, DocumentException {PdfReader reader = new PdfReader(src);PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest));PdfContentByte canvas = stamper.getOverContent(1);ColumnText.showTextAligned(canvas,Element.ALIGN_LEFT, new Phrase("Hello people!"), 36, 540, 0);stamper.close();}/*** Manipulates a PDF file src with the file dest as result* @param src the original PDF* @param dest the resulting PDF* @throws IOException* @throws DocumentException*/public static void stampIgnoreRotation(String src, String dest)throws IOException, DocumentException {PdfReader reader = new PdfReader(src);PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest));stamper.setRotateContents(false);PdfContentByte canvas = stamper.getOverContent(1);ColumnText.showTextAligned(canvas,Element.ALIGN_LEFT, new Phrase("Hello people!"), 36, 540, 0);stamper.close();}
}

2步创建PDF

第一步,创建文档内容,第二步,添加页码

import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.sql.SQLException;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Element;
import com.itextpdf.text.PageSize;
import com.itextpdf.text.Rectangle;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfStamper;
import com.itextpdf.text.pdf.PdfWriter;public class TwoPasses {/** The resulting PDF file. */public static final String RESULT= "results/part2/chapter06/page_x_of_y.pdf";/*** Main method.* @param    args    no arguments needed* @throws DocumentException * @throws IOException * @throws SQLException* @throws SQLException*/public static void main(String[] args)throws SQLException, DocumentException, IOException {// FIRST PASS, CREATE THE PDF WITHOUT HEADER// step 1Document document = new Document(PageSize.A4, 36, 36, 54, 36);// step 2ByteArrayOutputStream baos = new ByteArrayOutputStream();PdfWriter.getInstance(document, baos);// step 3document.open();// step 4// PDF文档创建...// step 5document.close();// SECOND PASS, ADD THE HEADER// Create a readerPdfReader reader = new PdfReader(baos.toByteArray());// Create a stamperPdfStamper stamper= new PdfStamper(reader, new FileOutputStream(RESULT));// Loop over the pages and add a header to each pageint n = reader.getNumberOfPages();for (int i = 1; i <= n; i++) {getHeaderTable(i, n).writeSelectedRows(0, -1, 34, 803, stamper.getOverContent(i));}// Close the stamperstamper.close();}/*** Create a header table with page X of Y* @param x the page number* @param y the total number of pages* @return a table that can be used as header*/public static PdfPTable getHeaderTable(int x, int y) {PdfPTable table = new PdfPTable(2);table.setTotalWidth(527);table.setLockedWidth(true);table.getDefaultCell().setFixedHeight(20);table.getDefaultCell().setBorder(Rectangle.BOTTOM);table.addCell("FOOBAR FILMFESTIVAL");table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);table.addCell(String.format("Page %d of %d", x, y));return table;}
}

添加公司信封到一个存在的文档

    /*** Manipulates a PDF file src with the file dest as result* @param src the original PDF* @param stationery a PDF that will be added as background* @param dest the resulting PDF* @throws IOException* @throws DocumentException*/public void manipulatePdf(String src, String stationery, String dest)throws IOException, DocumentException {// Create readersPdfReader reader = new PdfReader(src);PdfReader s_reader = new PdfReader(stationery);// Create the stamperPdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest));// Add the stationery to each pagePdfImportedPage page = stamper.getImportedPage(s_reader, 1);int n = reader.getNumberOfPages();PdfContentByte background;for (int i = 1; i <= n; i++) {background = stamper.getUnderContent(i);background.addTemplate(page, 0, 0);}// CLose the stamperstamper.close();}

插入页面到一个存在的文档

填充PDF表单

6.4 使用PdfCopy 拷贝页面

拼接和拆分PDF文档

拼接文档

import java.io.FileOutputStream;
import java.io.IOException;
import java.sql.SQLException;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Element;
import com.itextpdf.text.Phrase;
import com.itextpdf.text.pdf.ColumnText;
import com.itextpdf.text.pdf.PdfCopy;
import com.itextpdf.text.pdf.PdfImportedPage;
import com.itextpdf.text.pdf.PdfReader;public class ConcatenateStamp {/** The resulting PDF file. */public static final String RESULT= "results/part2/chapter06/concatenated_stamped.pdf";/*** Main method.* @param args no arguments needed* @throws DocumentException * @throws IOException* @throws SQLException*/public static void main(String[] args)throws IOException, DocumentException, SQLException {// use old examples to create PDFsMovieLinks1.main(args);MovieHistory.main(args);// step 1Document document = new Document();// step 2PdfCopy copy = new PdfCopy(document, new FileOutputStream(RESULT));// step 3document.open();// step 4// reader for document 1PdfReader reader1 = new PdfReader(MovieLinks1.RESULT);int n1 = reader1.getNumberOfPages();// reader for document 2PdfReader reader2 = new PdfReader(MovieHistory.RESULT);int n2 = reader2.getNumberOfPages();// initializationsPdfImportedPage page;PdfCopy.PageStamp stamp;// Loop over the pages of document 1for (int i = 0; i < n1; ) {page = copy.getImportedPage(reader1, ++i);stamp = copy.createPageStamp(page);// add page numbersColumnText.showTextAligned(stamp.getUnderContent(), Element.ALIGN_CENTER,new Phrase(String.format("page %d of %d", i, n1 + n2)),297.5f, 28, 0);stamp.alterContents();copy.addPage(page);}// Loop over the pages of document 2for (int i = 0; i < n2; ) {page = copy.getImportedPage(reader2, ++i);stamp = copy.createPageStamp(page);// add page numbersColumnText.showTextAligned(stamp.getUnderContent(), Element.ALIGN_CENTER,new Phrase(String.format("page %d of %d", n1 + i, n1 + n2)),297.5f, 28, 0);stamp.alterContents();copy.addPage(page);}// step 5document.close();}
}

拆分文档

import java.io.FileOutputStream;
import java.io.IOException;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.pdf.PdfCopy;
import com.itextpdf.text.pdf.PdfReader;public class Burst {/** Format of the resulting PDF files. */public static final String RESULT= "D:/data/iText/inAction/chapter06/timetable_p%d.pdf";/*** Main method.* @param    args    no arguments needed* @throws DocumentException * @throws IOException*/public static void main(String[] args)throws IOException, DocumentException {// Create a readerPdfReader reader = new PdfReader("D:/data/iText/inAction/chapter03/movie_posters.pdf");// We'll create as many new PDFs as there are pagesDocument document;PdfCopy copy;// loop over all the pages in the original PDFint n = reader.getNumberOfPages();for (int i = 0; i < n; ) {// step 1document = new Document();// step 2copy = new PdfCopy(document,new FileOutputStream(String.format(RESULT, ++i)));// step 3document.open();// step 4copy.addPage(copy.getImportedPage(reader, i));// step 5document.close();}}}

PdfCopy VS PdfSmartCopy

PdfSmartCopy 继承自PdfCopy,其会检查每页添加的冗余对象, 因此可以节省大量磁盘空间或

带宽。这种额外的“智慧”是要付出代价的。PdfSmartCopy 需要更多的内存和时间去拼接文档。

文件大小、带宽优先,选PdfSmartCopy

内存、时间优先,选PdfCopy

拼接表单

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/80119.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

深度思考ES面经

1 推荐文章 2万字详解&#xff0c;吃透 Elasticsearch 2 什么是倒排索引&#xff0c;为什么这么叫&#xff1f; 倒排索引&#xff08;Inverted Index&#xff09;是一种为快速全文搜索而设计的数据结构。它被广泛应用于搜索引擎&#xff0c;其中 Elasticsearch&#xff08;简…

C# 扫描并读取图片中的文字(.NET Core)

本文介绍如何通过C# 程序来扫描并读取图片中的文字&#xff0c;这里以创建一个.Net Core程序为例。下面是具体步骤&#xff0c;供参考。 程序测试环境&#xff1a; Visual Studio版本要求不低于2017 图片扫描工具&#xff1a;Spire.OCR for .NET 图片格式&#xff1a;png&…

JSP ssm 网上求职管理系统myeclipse开发mysql数据库springMVC模式java编程计算机网页设计

一、源码特点 JSP ssm 网上求职管理系统是一套完善的web设计系统&#xff08;系统采用SSM框架进行设计开发&#xff0c;springspringMVCmybatis&#xff09;&#xff0c;对理解JSP java编程开发语言有帮助&#xff0c;系统具有完整的源代码和数据库&#xff0c;系统主要采…

zookeeper最基础教程

文章目录 一、简介1、工作机制2、特点3、数据结构4、应用场景5、选举机制 二、软件安装1、单机版安装2、集群安装3、配置参数解读(zoo.cfg)4、ZK集群启动脚本 三、命令行操作1、语法2、使用3、节点相关4、监听器原理5、节点删除与查看 三、写数据流程 一、简介 1、工作机制 官…

SQL优化--排序优化(order by)

Using filesort : 通过表的索引或全表扫描&#xff0c;读取满足条件的数据行&#xff0c;然后在排序缓冲区sort buffer中完成排序操作&#xff0c;所有不是通过索引直接返回排序结果的排序都叫 FileSort 排序。 Using index : 通过有序索引顺序扫描直接返回有序数据&#xff0c…

1031. 两个非重叠子数组的最大和

1031. 两个非重叠子数组的最大和 原题链接&#xff1a;完成情况&#xff1a;解题思路&#xff1a;参考代码&#xff1a; 原题链接&#xff1a; 1031. 两个非重叠子数组的最大和 https://leetcode.cn/problems/maximum-sum-of-two-non-overlapping-subarrays/description/ 完…

【C语言】指针的进阶(一)

目录 前言 1. 字符指针 2. 指针数组 3. 数组指针 3.1 数组指针的定义 3.2 &数组名VS数组名 3.3 数组指针的使用 4. 数组参数、指针参数 4.1 一维数组传参 4.2 二维数组传参 4.3 一级指针传参 4.4 二级指针传参 5. 函数指针 前言 指针在C语言中可谓是有着举足轻重的…

Arm发布 Neoverse V2 和 E2:下一代 Arm 服务器 CPU 内核

9月14日&#xff0c;Arm发布了新的处理器内核&#xff1a;V2和E2&#xff0c;在官网已经可以看到相关的TRM 手册了。。 四年前&#xff0c;Arm发布了Neoverse系列的CPU设计。Arm决定加大力度进军服务器和边缘计算市场&#xff0c;专门为这些市场设计Arm CPU内核&#xff0c;而…

CocosCreator3.8研究笔记(十八)CocosCreator UI组件(二)

前面的文章已经介绍了Canvas 组件、UITransform 组件、Widget 组件 。 想了解的朋友&#xff0c;请查看 CocosCreator3.8研究笔记&#xff08;十七&#xff09;CocosCreator UI组件&#xff08;一&#xff09;。 今天我们主要介绍CocosCreator 常用容器组件&#xff1a;Layout …

[npm]脚手架本地全局安装1

[npm]脚手架本地全局安装1 npm link 全局安装npm install 全局安装卸载全局安装的脚手架 该文章是你的脚手架已经开发完成的前提下&#xff0c;你想要本地全局安装该脚手架&#xff0c;便于本地使用脚手架的命令的情况 npm link 全局安装 如果本地开发的项目是个脚手架&#…

【C语言】进阶——指针

目录 ①(●◡●)前言 1.字符指针 ✌字符指针和数组笔试题 2.指针数组 和数组指针 &#x1f44a;指针数组 &#x1f44a;数组指针 &#x1f44a;&数组名和数组名 3.数组传参和指针传参 &#x1f44a;一维数组传参 &#x1f44a;二维数组传参 &#x1f44a;一级…

云原生之使用Docker部署Nas-Cab个人NAS平台

云原生之使用Docker部署Nas-Cab个人NAS平台 一、Nas-Cab介绍二、本地环境介绍2.1 本地环境规划2.2 本次实践介绍 三、本地环境检查3.1 检查Docker服务状态3.2 检查Docker版本3.3 检查docker compose 版本 四、下载Nas-Cab镜像五、部署Nas-Cab5.1 创建挂载目录5.2 创建Nas-Cab容…

利用idea新创建maven项目时的一些基本配置

1.修改项目默认的maven仓库 file->Settings->Build 2.设置项目的jdk版本 设置完点OK即可。 同样的我们还需要在项目配置中进行修改。 通过以上设置一般就可以解决jdk版本不兼容地方问题。

稀土系储氢合金 压力-组成等温线 PCI 的测试方法

声明 本文是学习GB-T 29918-2023 稀土系储氢合金 压力-组成等温线 PCI 的测试方法. 而整理的学习笔记,分享出来希望更多人受益,如果存在侵权请及时联系我们 5 方法2:电化学法 5.1 方法提要 以储氢合金作负极&#xff0c;烧结氢氧化亚镍作正极&#xff0c;氢氧化钾水溶液作电…

postgresql-视图

postgresql-视图 视图概述使用视图的好处 创建视图修改视图删除视图递归视图可更新视图WITH CHECK OPTION 视图概述 视图&#xff08;View&#xff09;本质上是一个存储在数据库中的查询语句。视图本身不包含数据&#xff0c;也被称为 虚拟表。我们在创建视图时给它指定了一个…

数字IC设计之时序分析基础概念汇总

1 时钟Clock 理想的时钟模型是一个占空比为50%且周期固定的方波。时钟是FPGA中同步电路逻辑运行的一个基准。理想的时钟信号如下图: 2 时钟抖动Clock Jitter 理想的时钟信号是完美的方波&#xff0c;但是实际的方波是存在一些时钟抖动的。那么什么是时钟抖动呢?时钟抖动&#…

苹果电脑Mac系统运行速度又卡又慢是怎么回事?

通常大家处理Mac运行速度慢的方法不是重启就是清空废纸篓&#xff0c;但是这两种方法对于Mac提速性能的效果是微之甚微的&#xff0c;想要彻底解决Mac运行速度慢&#xff0c;你应该试试一下三种方法~ 1、清理磁盘空间 硬盘空间过少是Mac运行变慢很大的一个因素&#xff0c;各…

【LeetCode刷题笔记】动态规划 — 70.爬楼梯

创作不易&#xff0c;本篇文章如果帮助到了你&#xff0c;还请点赞 关注支持一下♡>&#x16966;<)!! 主页专栏有更多知识&#xff0c;如有疑问欢迎大家指正讨论&#xff0c;共同进步&#xff01; 更多算法知识专栏&#xff1a;算法分析&#x1f525; 给大家跳段街舞感谢…

Unity中 UI Shader的基本功能

文章目录 前言一、实现思路1、暴露一个 2D 类型的属性来接受UI的纹理2、设置shader的层级为TransParent半透明渲染层级&#xff0c;一般UI都是在这个渲染层级3、更改混合模式&#xff0c;是 UI 使用的纹理&#xff0c;该透明的地方透明 二、代码实现 前言 Unity中 UI Shader的…

Python爬虫逆向猿人学刷题系列——第七题

题目&#xff1a;采集这5页中胜点列的数据&#xff0c;找出胜点最高的召唤师&#xff0c;将召唤师姓名填入答案中 地址&#xff1a;https://match.yuanrenxue.cn/match/7 本题主要是考察字体的动态变化&#xff0c;同样也是从字体文件下手构造出映射关系就好&#xff0c;但本题…