我有一个23GB的文件,我想编辑第23行,但我在服务器上只有200 MB RAM.我不想完全打开文件,因为我只留下了20GB的可用磁盘空间.
我怎样才能做到这一点.我试图使用head,tail sed但它似乎创建了一个临时文件.没有临时文件可以做到吗?
我刚刚从 PdfBox 1.8 过渡到 2.0.0 并且有相当大的差异。在现有的 pdf 页面上写文本之前,我使用了 drawString。在 2.0.0 中,不推荐使用绘制字符串,但 showText 在块文本中不起作用。
我在 1.8 中的代码:
contentStream.beginText()
contentStream.moveTextPositionByAmount(250, 665)
contentStream.drawString("1 2 3 4 5 6 7 8 9 1 0")
contentStream.endText()
Run Code Online (Sandbox Code Playgroud)
我在 2.0 中的代码
PDDocument newPdf=null
newPdf=PDDocument.load(sourcePdfFile)
PDPage firstPage=newPdf.getPage(0)
PDPageContentStream contentStream = new PDPageContentStream(newPdf, firstPage, PDPageContentStream.AppendMode.APPEND,true,true)
contentStream.setFont(pdfFont, fontSize)
contentStream.beginText()
contentStream.lineTo(200,685)
contentStream.showText("John")
contentStream.endText()
Run Code Online (Sandbox Code Playgroud)
但它不起作用......
任何人都知道我如何像 1.8 一样编写文本